akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const int INF = 1000000000;
const int MOD = 1000000007;
int main(){
	int l,r;
	cin >> l >> r;
	if(r - l + 1 >= 2019)cout << 0 << endl;
	else{
		map<int,bool> used;
		for(int i = l;i <= r;i++){
			if(used[i%2019])break;
			used[i%2019] = true;
		}

		int ans = 2019;
		for(auto p:used){
			for(auto q:used){
				if(p.first != q.first)ans = min(ans,p.first*q.first%2019);
			}
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#define rep(i, n) for(int i = 0; i < n; i ++)
#define COUNT(i, n) for(int i = 1; i <= n; i ++)
#define ITER(c) __typeof((c).begin())
#define each(c, it) for(ITER(c) it =(c).begin(); it!=(c).end(); it++)
#define ALL(c) c.begin(), c.end()
#define mp make_pair
#define pb push_back
#define MEMSET(v, h) memset((v), h, sizeof(v))
#define X first
#define Y second

using namespace std; 

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

const int INF = 1 << 24;
const int N = 101;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};

int w, h;
char m[N][N];

void dfs(pii, char);

int main(void){
    for(int res; cin >> h >> w, h; cout << res << endl){
        rep(y, h) cin >> m[y];

        res = 0;
        rep(y, h) rep(x, w) if(m[y][x] != '.') dfs(mp(x, y), m[y][x]), res++;
    }

    return 0;
}

void dfs(pii p, char f){
    if(p.X < 0 || w <= p.X ||
       p.Y < 0 || h <= p.Y ||
       m[p.Y][p.X] != f) return;

    m[p.Y][p.X] = '.';

    rep(i, 4) dfs(mp(p.X + dx[i], p.Y + dy[i]), f);
}

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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    ll m = 1e9, M = 0;
    int midx = 0, Midx = 0;
    rep(i, n) {
        cin >> a[i];
        if (m > a[i]) {
            m = a[i];
            midx = i;
        }
        if (M < a[i]) {
            M = a[i];
            Midx = i;
        }
    }
    vector<P> p;
    ll tmp = m;
    int idx = midx;
    bool f = false;
    if (abs(tmp) <= M) { tmp = M; idx = Midx; f = true; }
    rep(i, n) {
        if (i == idx) continue;
        p.push_back(P(idx, i));
    }
    if (f) {
        for (int i = 1; i < n; ++i) {
            p.push_back(P(i-1, i));
        }
    }
    else {
        for (int i = n-2; i >= 0; --i) {
            p.push_back(P(i+1, i));
        }
    }
    cout << p.size() << endl;
    for (int i = 0; i < p.size(); ++i) {
        cout << p[i].first+1 << " " << p[i].second+1 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int a, b, c, i, sum=0;
    cin >> a >> b >> c;
    int arr[100];
    for(i=0; i<100; i++) arr[i]=0;
    arr[a-1]++; arr[b-1]++; arr[c-1]++;
    for(i=0;i<100;i++)if(arr[i]) sum++;
    cout << sum <<endl;
    
    return 0;
}


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

namespace ConsoleAppAtCoderABC170
{
    class Program
    {
        static void Main(string[] args)
        {
            var xy = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            var (x, y) = (xy[0], xy[1]);

            var possible = false;

            for (int i = 0; i <= x; i++)
            {
                var legs = 2 * i + 4 * (x - i);

                if(legs == y)
                {
                    possible = true;
                    break;
                }
            }

            WriteLine(possible ? "Yes" : "No");
        }
    }
}


Measured memory_bytes: 28112
N = int(input())
A = [int(input()) for _ in range(N)]

max_value = max(A)
max_index = A.index(max_value)

A.sort()
sec_max_value = A[-2]

for i in range(N):
    if i != max_index:
        print(max_value)
    else:
        print(sec_max_value)


Measured memory_bytes: 12532
use proconio::input;

fn main() {
    input! {
        a:i64,
        b:i64,
        c:i64,
        k:i64,
    };
    let acnt = std::cmp::min(k,a);
    let musc = std::cmp::max(0,k-a-b);
    println!("{}",acnt-musc);


}


Measured memory_bytes: 2104
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)
	m := make(map[int]int, N)
	for i := 0; i < N; i++ {
		var tmp int
		fmt.Scan(&tmp)
		m[tmp]++
	}
	cnt := 0
	for _, v := range m {
		cnt += v % 2
	}
	fmt.Println(cnt)
}


Measured memory_bytes: 5760
#include <iostream>
#include <algorithm>
#include <array>
#include <cstdint>
#include <functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>

#define INF 1000000000
#define MOD 1000000007
#define rep(i,a,b) for(uint32 i = (a); i < (b); ++i)
#define bitget(a,b) (((a) >> (b)) & 1)
#define ALL(x) (x).begin(),(x).end()
#define C(x) std::cout << #x << " : " << x << std::endl
#define scanf scanf_s

using int32 = std::int_fast32_t;
using int64 = std::int_fast64_t;
using uint32 = std::uint_fast32_t;
using uint64 = std::uint_fast64_t;

uint32 getd(uint64 a) {
	uint32 ret = 0;
	while (a) {
		++ret;
		a /= 10;
	}
	return ret;
}

int main(void) {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	uint32 n;
	uint64 ans = 0;
	std::cin >> n;
	std::vector<uint32> a(n);
	rep(i, 0, n)
		std::cin >> a[i];
	uint32 t = 1;
	ans += a[0] - 1;
	a[0] = 1;
	rep(i, 0, n) {
		if (t > a[i]) continue;
		if (t == a[i]) {
			++t;
			continue;
		}
		ans += (a[i] - 1) / t;
	}
	std::cout << ans << "\n";
	return 0;
}

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

int main() {
    int n;
    std::cin >> n;
    int res = 0;
    for (int i = 1; i <= n; ++ i){
        if ((i & 1) == 0){
            continue;
        }
        int kEnd = i/2;
        int cnt = 0;
        for (int k = 1; k <= kEnd; ++ k){
            if (i % k == 0){
                ++ cnt;
            }
        }
        if (cnt == 7){
            ++ res;
        }
    }
    std::cout << res;
    
    return 0;
}


Measured memory_bytes: 256
N = int( input() )
L = list( int(x) for x in input().split() )

ans = 0

for i in range( N - 2 ):
    li = L[i]
    for j in range( i + 1 , N - 1 ):
        lj = L[j]
        if li == lj:
            continue
        else:
            for k in range( j + 1 , N ):
                lk = L[k]
                if lk == li or lk == lj:
                    continue
                else:
                    if max(li,lj,lk) < (li + lj + lk - max(li,lj,lk)):
                        ans += 1
                        #print(li,lj,lk)

print(ans)


Measured memory_bytes: 9200
n,m=map(int,input().split())

if n>2 and m>2:
    print((n-2)*(m-2))
    
elif n==m==1:
    print("1")
    
elif n==1 or m==1:
    print(max(n,m)-2)
    
elif n==2 or m==2:
    print("0")

Measured memory_bytes: 3060
#include <cstdio>
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
	long long a,b,n;
	cin>>n>>a>>b;
	if((n==1&&a!=b)||(a>b)) return puts("0"),0;
	cout<<(n-1)*b+a-(n-1)*a-b+1<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 1e5 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n, k;
	cin >> n >> k;
	vector<int> v(n);
	for (auto& x : v) cin >> x;
	sort(v.rbegin(), v.rend());
	int sum = 0;
	for (int i = 0; i < k; i++) sum += v[i];
	cout << sum << endl;
	return 0;
}

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

struct Card {
    int value;
    char kind;
};

void printArray(Card A[], int N){
    
    for(int i=0; i<N; i++){
        cout << A[i].kind << A[i].value;
        if(i<N-1) cout << " ";
    }
    
    cout << endl;
    
}

void printStableSorted(Card a[], Card b[], int N){
    
    for(int i=1; i<=9; i++){
        
        //何個あるか
        int cnt = 0;
        for(int j=0; j<N; j++){
            if(a[j].value == i){
                cnt++;
            }
        }
        
        if(cnt==0) continue;
        
        //kindを順番にとうろく
        char akind[cnt];
        int ptr = 0;
        for(int j=0; j<N; j++){
            if(a[j].value == i){
                akind[ptr] = a[j].kind;
                ptr++;
            }
        }
        
        char bkind[cnt];
        ptr = 0;
        for(int j=0; j<N; j++){
            if(b[j].value == i){
                bkind[ptr] = b[j].kind;
                ptr++;
            }
        }
        
        //kindの順番が一致しているか
        for(int i=0; i<cnt; i++){
            if( akind[i] != bkind[i] ){
                cout << "Not stable" << endl;
                return;
            }
        }
        
    }
    
    cout << "Stable" << endl;
    
}

void flip(Card* a, Card* b){
    Card tmp = *a;
    *a = *b;
    *b = tmp;
}

void bubbleSort(Card C[], int N){
    
    for(int i=0; i<N; i++){
        for(int j=N-1; j>i; j--){
            if(C[j].value < C[j-1].value){
                flip(&C[j], &C[j-1]);
            }
        }
    }
    
}

void selectionSort(Card C[], int N){
    
    for(int i=0; i<N; i++){
        int minj = i;
        for(int j=i; j<N; j++){
            if( C[j].value < C[minj].value ){
                minj = j;
            }
        }
        flip(&C[i], &C[minj]);
    }
    
}

int main() {
    
    int N;
    cin >> N;
    
    Card C[N];
    for(int i=0; i<N; i++){
        cin >> C[i].kind >> C[i].value;
    }
    
    Card C_b[N];
    Card C_s[N];
    for(int i=0; i<N; i++){
        C_b[i] = C[i];
        C_s[i] = C[i];
    }
    
    bubbleSort(C_b, N);
    selectionSort(C_s, N);
    
    printArray(C_b, N);
    printStableSorted(C, C_b, N);
    printArray(C_s, N);
    printStableSorted(C, C_s, N);
    
    return 0;
}


Measured memory_bytes: 3108
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int A, B;
    cin >> A >> B;
    cout << A * B << endl;
    return 0;
}

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

int main() {
  int n,a[8];
  string str;
  while(cin >> n) {
    getline(cin,str);
    for(int i=0;i<n;i++) {
      getline(cin,str);
      for(int j=0;j<8;j++) {
        a[j] = atoi(str.substr(j,1).c_str());
      }
      sort(a,a+8);
      int d = 10000000;
      int min=0,max=0;
      for(int j=0;j<8;j++) {
        min += a[j]*d;
        d/=10;
      }
      d=10000000;
      for(int j=0;j<8;j++) {
        max += a[7-j]*d;
        d/=10;
      }
      cout << max-min << endl;
    }
  }
}

Measured memory_bytes: 0
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

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

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(v) (v).begin(), (v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;



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

    double a, b, x;
    cin >> a >> b >> x;

    double h;
    double rad;

    if (x/a < a*b/2) {
        h = 2*x/(a*b);
        rad = atan2(h,b);
    } else { 
        h = 2*x/(a*a) - b;
        rad = atan2(a,b-h);
    }

    double theta = rad * 180.0 / M_PI;

    cout << setprecision(12) << 90.0 - theta << endl;

    return 0;
}


Measured memory_bytes: 256
a,b=map(int, input().split(" "))
for i in range(a):
    if i ==0:
        arr=list(map(int, input().split(" ")))[1:]
    else:
        tmp=set(list(map(int, input().split(" ")))[1:])
        arr=(set(arr) & set(tmp))
#print(arr)
print(len(arr))
    

Measured memory_bytes: 3060
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Sparsh Sanchorawala
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AAirplane solver = new AAirplane();
        solver.solve(1, in, out);
        out.close();
    }

    static class AAirplane {
        public void solve(int testNumber, InputReader s, PrintWriter w) {
            int a = s.nextInt(), b = s.nextInt(), c = s.nextInt();
            w.println(Math.min(Math.min(a + b, b + c), c + a));
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 21204
using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;

namespace SolutionCS
{
    class Entity : IComparable<Entity>
    {
        public string city;
        public int score;
        public int index;

        public int CompareTo(Entity e)
        {
            int c = city.CompareTo(e.city);
            if ( c != 0)
            {
                return c;
            }

            return -score.CompareTo(e.score);
        }


    }

    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());

            List<Entity> listEnt = new List<Entity>();

            for (int i = 0; i < N; i++)
            {
                string[] ins = Console.ReadLine().Split(' ');

                Entity e = new Entity();
                e.city = ins[0];
                e.score = int.Parse(ins[1]);
                e.index = i;

                listEnt.Add(e);
            }

            listEnt.Sort();

            for(int i=0;i<N;i++)
            {
                Console.WriteLine("{0}",listEnt[i].index + 1);
            }
        }
    }
}


Measured memory_bytes: 11360
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

Measured memory_bytes: 256
import sys
input = sys.stdin.readline


def read():
    a, b, c, d = map(int, input().strip().split())
    return a, b, c, d


def solve(a, b, c, d):
    ans = [a * c, a * d, b * c, b * d]
    if a * b < 0 or c * d < 0:
        ans.append(0)
    return max(ans)


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))


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

int main() {
int N,T,A;cin>>N>>T>>A;
int hoge=10000000;
vector<int>H(N);
for(int i = 0; i < N; i++)
{ cin>>H.at(i);
  int temper=T*1000-H.at(i)*6;
  H.at(i)=abs(temper-A*1000);
  hoge=min(hoge,H.at(i));
}
for(int i=0;i<N;i++){
    if(hoge==H.at(i))
    {
        cout<<i+1<<endl;
        break;
    }
}


}

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

int main()
{
	int A, B, C, K;
	scanf("%d %d %d %d", &A, &B, &C, &K);

	if (K < A)
		printf("%d\n", K);
	else if (K >= A && K <= A+B)
		printf("%d\n", A);
	else if (K > A+B && K < A+B+C)
		printf("%d\n", A-(K-A-B));
	else if (K >= A+B+C)
		printf("%d\n", A-C);
	return EXIT_SUCCESS;
}


Measured memory_bytes: 1728
#include<bits/stdc++.h>
using namespace std;
#define forr(i,a,n)     for(long long int i=a; i<n; i++)
#define loop(i,a,n)     for(long long int i=a; i>=n; i--) 

int main()
{
	ios_base :: sync_with_stdio(false),cin.tie(NULL);
	
	int a;
	cin>>a;
	vector<pair<long long int, pair<long long int, long long int>>> w,v;
	forr(i, 0, a)
	{
		long long int x, y;
		cin>>x>>y;
		v.push_back({x+y, {x, y}});
		w.push_back({x-y, {x, y}});
	}
	sort(v.begin(), v.end());
	sort(w.begin(), w.end());
	cout<<max({(abs(v[0].second.first-v[a-1].second.first)+abs(v[0].second.second-v[a-1].second.second)), (abs(w[0].second.first-w[a-1].second.first)+abs(w[0].second.second-w[a-1].second.second))});
		
	return 0;
}

Measured memory_bytes: 12784
#include <iostream>
using namespace std;
int main(void){
    
    int n,x,y,b,p,a;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x>>y>>b>>p;
        a=x*b+y*p;
        if(b>=5&&p>=2){
            a=a*0.8;
        }
        else if(b<5&&p>=2&&a>(x*5+y*p)*0.8){
            a=(a+x*(5-b))*0.8;
        }
        else if(b>=5&&p<2&&a>(x*b+y*2)*0.8){
            a=(a+y*(2-p))*0.8;
        }
        else if(b<5&&p<2&&a>(x*5+y*2)*0.8){
            a=(a+x*(5-b)+y*(2-p))*0.8;
        }
        cout<<a<<endl;
    }
    
}



Measured memory_bytes: 3104
#include <iostream>
using namespace std;
int main(void){
   // Your code here!
   double a, b;
   
   while(cin>>a>>b){
       if(a<35.50 && b<71.00){
           cout<<"AAA"<<endl;
       }
       else if(a<37.50 && b<77.00){
           cout<<"AA"<<endl;
       }
       else if(a<40.00 && b<83.00){
           cout<<"A"<<endl;
       }
       else if(a<43.00 && b<89.00){
           cout<<"B"<<endl;
       }
       else if(a<50.00 && b<105.00){
           cout<<"C"<<endl;
       }
       else if(a<55.00 && b<116.00){
           cout<<"D"<<endl;
       }
       else if(a<70.00 && b<148.00){
           cout<<"E"<<endl;
       }
       else  cout<<"NA"<<endl;
   }
   return 0;

}



Measured memory_bytes: 3200
import heapq
n = int(input())
a = []
for i in range(n):
    a.append(i)
    a[i] = int(input())

m = heapq.nlargest(2,a)

if m[0]==m[1]:
    for i in range(n):
        print(m[0])

else:
    for i in range(n):
        if a[i] ==m[0]:
            print(m[1])
        else:
            print(m[0])

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

for i in range(N):
    d=float("inf")
    ans=-1
    for j in range(M):
        if d>abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1]):
            d=abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])
            ans=j+1
    print(ans)

Measured memory_bytes: 9224
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
int n, p;

int main(){
    cin >> n;
    for(int i = 1 ; i <= n ; i++){
        int a;
        cin >> a;
        if( p <= a){
            p = max(p,a-1);
        }else{
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int x,a,b,A,B;
	scanf("%d%d%d",&x,&a,&b);
	A=x-a;
	B=b-x;
	if(A<0){
		A=A*-1;
		}
	if(B<0){
		B=B*-1;
		}
	if(A<B){
		printf("A\n");
		}
	if(B<A){
		printf("B\n");
		}
	return 0;
}

Measured memory_bytes: 128
import copy
s = input()
t = input()
ls = list(s)
lt = list(t)
done = 0
for a in range(len(t)):
    # if(done):
    #     break
    for b in range(len(s)):
        ls = list(s)
        lt = list(t)
        # if(done):
        #     break
        find = 1
        if ls[b] == lt[a] or ls[b] == '?':
            if b >= a and b + (len(t) - (a+1)) <= len(s) - 1:
                for c in range(len(t)):
                    if lt[c] == ls[b-a+c] or ls[b-a+c] == '?':
                        # print("good:",b-a+c,c,ls[b-a+c],lt[c]," | ",b,a,find)
                        pass
                    else:
                        # print("bad:",b-a+c,c,ls[b-a+c],lt[c]," | ",b,a,find)
                        find = 0
                        break
                if(find):
                    ans = copy.deepcopy(ls)
                    for d in range(len(t)):
                        ans[b-a+d] = lt[d]
                    done = 1
                    # break
if done:
    for e in range(len(s)):
        if ans[e] == '?':
            ans[e] = 'a'
    print("".join(ans))
else:
    print("UNRESTORABLE")

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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define repr(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())

const int IINF = 1e9 + 100;
const long long LLINF = 2e18 + 129;
const long long MOD = 1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

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

    lint x, y;
    cin >> x >> y;

    if(abs(x - y) <= 1LL){
        cout << "Brown" << endl;
    }else{
        cout << "Alice" << endl;
    }

    return 0;
}

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

namespace ABC150
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] kx = Console.ReadLine().Split().Select(int.Parse).ToArray();
            string ans = "No";
            if (kx[0] * 500 >= kx[1]) { ans = "Yes"; }
            Console.WriteLine(ans);
        }
    }
}


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

void swap(int *a, int *b){
  int tmp;
  tmp = *a;
  *a = *b;
  *b = tmp;
}

int main(){

  int w,n;
  cin >> w;
  cin >> n;

  int list[40];
  for(int i = 0; i < 40 ; i++){
    list[i] = i;
  }

   int a,b;
   char tmp;
   while( cin >> a >> tmp >> b ){
    swap( &list[a], &list[b] );
  }
  
  for(int  i = 1; i <= w ; i++ ){
    cout << list[i] << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1160
if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))

    count = 1

    l = 0
    r = 1
    x = A[0]
    s = A[0]

    while r < N:
        s += A[r]
        x ^= A[r]
        while s != x:
            s -= A[l]
            x ^= A[l]
            l += 1
        r += 1
        count += r-l

    print(count)


Measured memory_bytes: 24712
#include <iostream>

int main()
{
	int W, H, x, y, r;
	std::cin >> W >> H >> x >> y >> r;

	if (x + r > W || x - r<0 || y + r>H || y - r < 0) {
		std::cout << "No" << std::endl;
	}
	else{
 std::cout << "Yes" << std::endl;
}

	
    return 0;
}

Measured memory_bytes: 3124
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<string>
typedef long long ll;
typedef unsigned long long ull;
const ll LINF = 1e18;
const int INF = 1e8;
using namespace std;


//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()		
#define debug system("pause")				//デバッグ用

int euclidean_gcd(int, int);

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

	int n;
	cin >> n;
	vector<ll> a(n);
	ll ans=0;

	ll ma = 0;
	int signCon[2] = {};

	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		if (a[i] >= 0)
		{
			signCon[0]++;
		}
		else
		{
			signCon[1]++;
		}
	}

	vector<ll> b(n);
	for (int i = 0; i < n; i++)
	{
		b[i] = abs(a[i]);
	}

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

	if (signCon[1] % 2 == 1)
	{
		ans += -1 * b[0];
		for (int i = 1; i < n; i++)
		{
			ans += b[i];
		}
	}
	else
	{
		for (int i = 0; i < n; i++)
		{
			ans += b[i];
		}
	}

	cout << ans << endl;


	

}

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

int n;
ll base = 1, ans;

double S(ll x) {
	int res = 0; ll y = x;
	while (x) {
		res += x % 10;
		x /= 10;
	}
	return y / (res * 1.0);
}

int main() {
	scanf("%d", &n);
	while (n--) {
		while (1) {
			if (S(ans + base) > S(ans + base * 10))
				base *= 10;
			else break;
		}
		ans += base;
		printf("%lld\n", ans);
	}
	return 0;
}

Measured memory_bytes: 3716
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << endl;
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

ll modpow(ll x, ll n, ll mod){
	ll res = 1;
	while(n > 0){
		if(n & 1) res = res * x % mod;
		x = x * x % mod;
		n >>= 1;
	}
	return res;
}

template <std::uint_fast64_t Modulus> class modint {
  using u64 = std::uint_fast64_t;

public:
  u64 a;

  constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
  constexpr u64 &value() noexcept { return a; }
  constexpr const u64 &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
	return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
	return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
	return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
	return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
	a += rhs.a;
	if (a >= Modulus) {
	  a -= Modulus;
	}
	return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
	if (a < rhs.a) {
	  a += Modulus;
	}
	a -= rhs.a;
	return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
	a = a * rhs.a % Modulus;
	return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
	u64 exp = Modulus - 2;
	while (exp) {
	  if (exp % 2) {
		*this *= rhs;
	  }
	  rhs *= rhs;
	  exp /= 2;
	}
	return *this;
  }
};

using mint = modint<mod>;

int main(){
	ll n,k; cin >> n >> k;
	vector<mint> cnt(k+1);
	mint ans = 0;
	for(ll i=k; i>=1; i--){
		cnt[i] = modpow(k/i,n,mod);
		for(ll j=i+i; j<=k; j+=i){
			cnt[i] -= cnt[j];
		}
		ans += cnt[i] * i;
	}
	cout << ans.value() << endl;
}


Measured memory_bytes: 4056
def main():
    n, q = map(int, input().split())
    nums = [0] * (n+1)
    
    for i in range(q):
        com, x, y = map(int, input().split())
        
        if not com:
            while x <= n:
                nums[x] += y
                x += x & -x
        else:
            x -= 1
            s_sum = 0
            while x:
                s_sum += nums[x]
                x -= x & -x
            t_sum = 0
            while y:
                t_sum += nums[y]
                y -= y & -y
                
            print(t_sum - s_sum)

if __name__ == '__main__':
    main() 


Measured memory_bytes: 7932
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

int main()
{
	string s,t,tmp;
	int ex=0;
	
	vector<string> v;
	
	cin >> s >> t;
	
	
	for(int i=0;i<s.length()-t.length()+1;i++){
		tmp = s;
		
		int flag = 1;
		
		for(int j=0;j<t.length();j++){
			if(s[i+j] == '?')tmp[i+j] = t[j];
			else tmp[i+j] = s[i+j];
		}
		
		for(int j=0;j<t.length();j++){
			if(tmp[i+j] != t[j]){
				flag = 0;
				break;
			}
		}
		
		if(flag == 1) {
			for(int j=0;j<s.length();j++){
				if(tmp[j] == '?')tmp[j] = 'a';
			}
			v.push_back(tmp);
			ex=1;
		}
	}
	
	sort(v.begin(),v.end());
	
	
	if(ex == 1)cout << v[0] << endl;
	else cout << "UNRESTORABLE" << endl;
	
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int inf{int(1e9)};

string f(ll n){
  if (n == 0) return "";
  n--;
  return f(n / 26) + char('a' + n % 26);
}

int main(void){
  ll N;
  cin >> N;

  cout << f(N) << endl;
}


Measured memory_bytes: 3604
using System;class A{static void Main(){
    while(true){
        int a=int.Parse(Console.ReadLine());
        if(a==-1){break;}
        string S="";
        while(true){if(a<=3){   S=""+a%4+""+S;break;}
     S=""+a%4+""+S;
        a/=4;
        
        }Console.WriteLine(S);
    }
    
}}

Measured memory_bytes: 9276
#include <iostream>
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <tuple>
#include <utility>
#include <functional>
#include <sys/time.h>
#include <iomanip>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(i, m, n) for(int i = (m); i < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
void setp(const int n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
//constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

constexpr int SZ = 26;
constexpr int D = 365;
array<int, SZ> C;
array<array<int, SZ>, D> S;

int main(void){
	int tmp;
	cin >> tmp;
	rep(i, SZ) cin >> C[i];
	rep(i, D) rep(j, SZ) cin >> S[i][j];

	array<int, SZ> last;
	rep(i, SZ) last[i] = 0;

	for (int d = 1; d <= D; ++d){
		int max = 0, ans = 0;
		rep(i, SZ) if (chmax(max, S[d][i])) ans = i;
		cout << ans + 1 << endl;
		last[ans] = d;
	}

	return 0;
}


Measured memory_bytes: 3676
using System;


    public static class Program
    {
    static void Main()
    {

        for (var i = 1; i <= 9; i++)
        {
            for (var j = 1; j <= 9; j++)
            {
                Console.WriteLine(i + "x" + j + "=" + i*j);
            }
        }
        
       
    }
    }




Measured memory_bytes: 17836
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#include<cmath>
//#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
template <class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template <class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template <class T> inline T gcd(T a, T b) {if(a==0) return b; return gcd(b%a,a);}
template <class T> inline T lcm(T a, T b) {return a * b / gcd(a,b);}
template <class T> inline T sum(vector<T> &vec) {T res=0; for (int i = 0; i < vec.size(); i++) res += vec[i]; return res;}
template <class T> inline T mpow(T a, T b) {if(b==0)return 1; T c = mpow(a,b/2);if(b%2==1)return c*c*a; return c*c;}
const int INF = 1 << 30;
const long long INFLL = 1LL << 60;
typedef pair<int, int> P;

#define REP(i,n) for (int (i)=0;(i)<(n);(i)++)
#define FOR(i,n) for (int (i)=0;(i)<(n);(i)++)
#define REPB(i,n) for (int (i)=((n)-1);(i)>=0;(i)--)
#define FORB(i,n) for (int (i)=((n)-1);(i)>=0;(i)--)
#define SORT(A) sort((A).begin(),(A).end())

int main() {
    /*
    ll H, N; cin >> H >> N;
    vint A(N);
    FOR(i,N) cin >> A[i];

    ll tmp = 0;
    FOR(i,N) tmp += A[i];

    if (tmp >= H) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }*/

    ll N, K; cin >> N >> K;
    vll H(N);
    FOR(i,N) cin >> H[i];
    
    ll res = 0;
    SORT(H);
    FOR(i,N-K) {
        res += H[i];
    }
    cout << res << endl;
}


Measured memory_bytes: 1792
#include "iostream"
using namespace std;

int main() {
	int a,b,n,min=100,count;
	cin >> n;
	for (int i = 1; i <= n / 2; i++) {
		a = n - i;
		b = i;
		count = (a % 100000 - a % 10000) / 10000 + (a % 10000 - a % 1000) / 1000 + (a % 1000 - a % 100) / 100 + (a % 100 - a % 10) / 10 + (a % 10)+ (b % 100000 - b % 10000) / 10000 + (b % 10000 - b % 1000) / 1000 + (b % 1000 - b % 100) / 100 + (b % 100 - b % 10) / 10 + (b % 10);
		if (count < min)min = count;
	}
	cout << min << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int a,b,c;
int main()
{
	scanf("%d%d%d",&a,&b,&c);
	if((a&1) && (b&1) && (c&1))printf("%lld",min(1LL*a*b,min(1LL*b*c,1LL*a*c)));else printf("0");
	return 0;
}

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

#define ll long long int
#define mod (1000000007)

int main()
{
    ll n;
    cin>>n;
    ll ar[n+1];
    ll ans=0,sum=0;
    for(ll i=1;i<=n;i++)
    {
        cin>>ar[i];
        ans+=(sum*ar[i])%mod;
        sum=(sum+ar[i])%mod;
    }
    cout<<ans%mod<<endl;
    return 0;
}


Measured memory_bytes: 5192
#include<stdio.h>
 
int main(){
    int i1,i2,i3,i4,x=0,n;
    while(scanf("%d",&n)!=EOF){
    for(i1=0;i1<10;i1++){
    for(i2=0;i2<10;i2++){
    for(i3=0;i3<10;i3++){
    for(i4=0;i4<10;i4++)
        if(i1+i2+i3+i4==n)x++;
    }}}
    printf("%d\n",x);
    x=0;
    }
    return 0;
}

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

using pii = pair<int,int> ;
using pll = pair<long,long> ;
using umpii = unordered_map<int,int> ;
using mpii = map<int,int> ;
#define int long long
#define f first
#define s second

int32_t main(){
	int n ;
	cin >> n ;
	pii a[n] ;
	for(int i = 0 ; i < n ; i++) cin >> a[i].s >> a[i].f ;
	sort(a,a+n) ;
	int sum = 0 ;
	for(auto i : a ){
		sum += i.s ;
		if(sum > i.f){
			cout << "No" ;
			return 0 ;
		}
	}
	cout << "Yes" ;
	return 0 ;
}



Measured memory_bytes: 1792
X, K, D = map(int, input().split())
deka = pow(10,20)
X = abs(X)

if K * D < X:
    print(abs(X - K * D))
else:
    cnt1 = X // D
    ans1 = deka
    if cnt1 <= K:
        rem = K - cnt1
        if rem % 2 == 0:
            ans1 = X - cnt1 * D
        else:
            ans1 = abs(X - cnt1 * D - D)
    
    cnt2 = (X+D-1) // D
    ans2 = deka
    if cnt2 <= K:
        rem = K - cnt2
        if rem%2 == 0:
            ans2 = cnt2 * D - X
        else:
            ans2 = abs(cnt2 * D - X - D)
    
    print(min(ans1, ans2))

Measured memory_bytes: 61784
n = gets.to_i
x = []
n.times do
  x << gets.split.map(&:to_i)
end
y = Array.new(n,0)
0.upto(n-1) do |i|
  y[i] = i+1
end
com = y.permutation(n).to_a
count = 0
com.each_with_index do |i|
  0.upto(i.length-2) do |num|
    c = (x[(i[num+1]-1)][0]-x[(i[num]-1)][0])**2
    d = (x[(i[num+1]-1)][1]-x[(i[num]-1)][1])**2
    count+=Math.sqrt(c+d)
  end
end
puts count/com.length

Measured memory_bytes: 20180
#include <bits/stdc++.h>
using namespace std;
typedef int64_t i64;
typedef long long LL;
typedef long long ll;
typedef long double LD;
typedef complex <LD> cld;
typedef unsigned int uint;
typedef complex <double> cd;
typedef unsigned long long ULL;

#define endl "\n"
#define dendl "\n\n"
#define mp make_pair
#define mt make_tuple
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

/////////////////////////////////////////////////////////////////////

const int LOG = 64;
const int N = (int)2e5 + 7;
const int MAXN = (int)1e6 + 7;
const int MOD = (int)1e9 + 7;
const int INF = (int)2e9 + 7;
const int CONST = 450;
const LL LINF = (i64)1e18;
const LD PI = 3.1415926535897932384626433832795;
const LD EPS = 1;

/////////////////////////////////////////////////////////////////////
ll power(ll x, ll y, ll p)  
{  
    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;  
}  
vector<int> adj[100001];
int visited[100001] = {0};
void dfs(int s){
	visited[s]=1;
	for (int i : adj[s])
	{
		if (!visited[i])
			dfs(i);
	}
}
void solve() {
	int n,m;
	cin>>n>>m;
	for(int i=0;i<m;i++){
		int u,v;
		cin>>u>>v;
		u--,v--;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	int ans=0;
	for(int i=0;i<n;i++){
		if(visited[i]!=1){
			dfs(i);
			ans++;
		}
	}
	cout<<ans-1<<endl;
}

int main() {
	#ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif 

	ll t;
	t=1;
	while(t--){
	    solve();
	}
}

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

const int MAX = 200005;
int p[MAX];

int main()
{
	int n, t;
	scanf("%d %d", &n, &t);
	for(int i = 0; i < n; i++) {
		scanf("%d", p + i);
	}

	int sum = 0, start = p[0], stop = t;
	for(int i = 0; i < n; i++) {
		if( p[i] <= stop) {
			//sum += p[i];
			stop = p[i] + t;
		}
		else if(p[i] > stop) {
			sum += stop - start;
			start = p[i];
			stop = p[i] + t;
		}
	}
	if(p[n-1] < stop) {
		sum += p[n-1] -  start + t;
	}

	printf("%d", sum);
}

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

/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
int main() {
	int N;
	cin >> N;
	vector<int> c;
	int b = 0;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		int sum = 0;
		while (a %2 == 0) {
			a = a / 2;
			sum++;
		}
		b = b + sum;
	}
	cout << b;
}

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

int main()
{
  string s, t, u;
  int a, b;

  cin >> s >> t >> a >> b >> u;

  if (u == s) {
    a--;
  }

  if (u == t) {
    b--;
  }

  cout << a << " " << b << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <set>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <memory.h>
#include <string>
#include <sstream>
#include <cstdlib>
#include <ctime>
#include <cassert>

using namespace std;

typedef long long LL;
typedef pair<int,int> PII;

#define MP make_pair
#define PB push_back
#define FF first
#define SS second

#define FORN(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD(i, n) for (int i = (int)(n) - 1; i >= 0; i--)

#define DEBUG(X) { cout << #X << " = " << (X) << endl; }
#define PR0(A,n) { cout << #A << " = "; FORN(_,n) cout << A[_] << ' '; cout << endl; }

#define MOD 1000000007
#define INF 2000000000

int GLL(LL& x) {
    return scanf("%lld", &x);
}

int GI(int& x) {
    return scanf("%d", &x);
}

const int MAXN = 1000005;
LL dp[MAXN], sumdp[MAXN];

void add(LL& x, LL y) {
    x += y;
    if (x >= MOD) x -= MOD;
}

void sub(LL& x, LL y) {
    x -= y;
    if (x < 0) x += MOD;
}

LL mul(LL x, LL y) {
    return (x * y) % MOD;
}

int n;

int main() {
    GI(n);

    memset(dp, 0, sizeof dp);
    memset(sumdp, 0, sizeof sumdp);

    dp[1] = n;
    sumdp[1] = n;

    for (int i = 2; i <= n; i++) {
        dp[i] = sumdp[i-1];
        if (i > 2) sub(dp[i], dp[i-2]);

        int left = n - (i - 2 + (i == 2));

        add(dp[i], left);
        add(dp[i], mul(n-1, n-1));

        sumdp[i] = sumdp[i-1];
        add(sumdp[i], dp[i]);
    }

    cout << dp[n] << "\n";

    return 0;
}

Measured memory_bytes: 16000
/******************************************
* AUTHOR : Lokesh goel*
* NICK : InsaneNerd *
* INSTITUTION : NIT Kurukshetra *
******************************************/
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MAX 1000000000
#define N 100005
#define pii pair<int,int>
#define vp vector<pair<int,int > >
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define gsz(x) ((int)(x).size())
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);cerr.tie(NULL);
#define endl "\n"
#define ms(x,v) memset(x,v,sizeof(x))

double maxvolume(double s) 
{ 
    // finding length 
    double length = s / 3; 
  
    s -= length; 
  
    // finding breadth 
   	double breadth = s / 2; 
  
    // finding height 
    double height = s - breadth; 
  
    return length * breadth * height; 
}  

int main()
{
	fastio;
	double l,i,j,k,n;
	cin>>l;
	cout<<setprecision(10)<<maxvolume(l)<<endl;


	return 0;
}

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

int main(){
    int n;
    cin >> n;
    int ans = 0;
    for(int i=0;i<n;++i){
        int l, r;
        cin >> l >> r;
        ans += r - l + 1;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
///#pragma GCC optimize("Ofast")
///#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
///#pragma GCC optimize("unroll-loops")

#include<bits/stdc++.h>
using namespace std;

///#include<ext/pb_ds/assoc_container.hpp>
///#include<ext/pb_ds/tree_policy.hpp>
///using namespace __gnu_pbds;
///template<typename T> using orderset = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
///(X).order_of_key(value) /// return lower_bound(value)
///(*X).find_by_order(index) /// return value (0 index)

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); /// mt19937_64 (long long)

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vii> vvii;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<bool> vbb;

const int N = 1000001;
const int MOD = 1000000007;
const ll INF = LLONG_MAX;

#define fast() ios_base::sync_with_stdio(false),cin.tie(NULL)
#define next(x) next_permutation(all(x))
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rev(a) reverse(all(a))
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define yes cout<<"YES"<<nl
#define no cout<<"NO"<<nl
#define space ' '
#define nl '\n'
#define PI acos(-1)
#define Case(x) cout<<"Case "<<x<<": "
#define strtoint(a) atoi(a.c_str())
#define dbg(x) cerr<<#x<<" is "<<x<<'\n';
#define fix(x) cout<<fixed<<setprecision(x)
#define leastonepos(x) __builtin_ffs(x)
#define leadingoff(x) __builtin_clz(x)
#define trailingoff(x) __builtin_ctz(x)
#define numofone(x) __builtin_popcount(x)
#define time() cerr<<"Time elapsed : "<<clock()*1000.0/CLOCKS_PER_SEC<<"ms"<<'\n'

#define coutv(v) for(auto it:v)cout<<it<<space;cout<<nl;
#define cinv(v) for(auto &it:v)cin>>it;

///................Graph's Move.................
///const int dx[] = {+1,-1,+0,+0}; ///Rock's Move
///const int dy[] = {+0,+0,+1,-1}; ///Rock's Move
///const int dx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's Move
///const int dy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move
///const int dx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's Move
///const int dy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's Move
///*.....................-_-........................*///



int main()
{
    fast();
    int tc=1,cs=0;
    //cin>>tc;
    while(tc--)
    {
        int n,i,k,j;
        cin>>n;
        vvii v(n,vii(3)),dp(n,vii(3));
        for(i=0; i<n; i++)
            for(j=0; j<3; j++)
                cin>>v[i][j];
        dp[0][0]=v[0][0];
        dp[0][1]=v[0][1];
        dp[0][2]=v[0][2];
        for(i=1; i<n; i++)
            for(j=0; j<3; j++)
                for(k=0; k<3; k++)
                {
                    if(j==k)
                        continue;
                    dp[i][k]=max(dp[i][k],dp[i-1][j]+v[i][k]);
                }
        int ans=*max_element(all(dp[n-1]));
        cout<<ans<<nl;
    }
}


Measured memory_bytes: 14224