akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <deque>

using namespace std;

#define FOR(i, start, end) for(ll i = (start); i < (end); i++)
#define rep(i, n) FOR(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define ctoi(c) c - '0'
#define tos(s) to_string(s)

typedef long long ll;

int main() {
    string s;
    cin >> s;
    ll sum = 0;
    rep (i ,s.length()) {
        sum += ctoi(s[i]);
    }
    if (sum%3==0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

/*
ACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACAC                                                                              
                                   ******,  .,, .,, ,,,    ****.**              
                                   ** . .,,,,,,,,,,,,,,,,,,,,,. .,*             
                                   **,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.            
                                .,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.        
                                .,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.        
                    ****      ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,      
              ***************,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,    
         ********************,,,,,,,,,,,,,,@@@,,,,,,,,,,,/@@@,,,,,,,,,,,,,,,    
        ******************,,,,,,,,,,,,,,,,,,(,,.         ,,,,,,,,,,,,,,,,,,,    
       ********************,,,,,,,,,,,*,,,,,.     %&&&     .,,,,*,,,,,,,,,,,,.  
       ***,,,,,,,,,,,,,,*,,,,,,,,,,,,,,,,,,,,               ,,,,,,,,,,,,,,,,,   
       ,,,,,,,,,,,,,,,,,,,**,,,,,,,,,,.......      ##(     ........,,,,,,,,,,.  
     .,,,,,,,,,,,,,,,,,,**,,,,,,,,,,..............    ..............,,,,,,,,    
    .,,,,,,,,,,,,,,,,,,,**,,,,,,,,,.................................,,,,,,,,,   
   ,,,,,,,,,,,,,,,,,,,,***,,,,,,,....................................,,,,,,,,,  
   ,,,,,,,,,,,,,,,,,,,,**,,,,,,,,.....................................,,,,,,,   
   ,,,,,,,,,,,,,,,,,,,,,**,,,,,,,,....................................,,,,,,,   
   ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.....................................,,,,,     
   ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,...................................,.,,,,,     
    ,,,,,,,,,,,,,,,,,,,,,,,,,,,,.....................................,,,        
     ,,,,,,,,,,,,,,,,,,,,,,,,,,,,....................................,,,        
      ,,,,,,,,,,,,,,,,,,,,,,,,,,,,...................................,          
       ..,,,,,,,,,,,,,,,,,,,,,,,,,,.................................,           
       .........**.....       ,,,,,..............................               
        .......*......                  ****,**,       ,..****                  
        .......*,....                   .......        ......                   
          .......*....                   .....          .....                   
                                         ......          .....                  
*/

Measured memory_bytes: 3340
import heapq

N,M = map(int,input().split(" "))
nums = map(int,input().split(" "))

nums = [n * -1 for n in nums]
heapq.heapify(nums)

while M > 0:
    curr = -heapq.heappop(nums)
    heapq.heappush(nums,-(curr//2))
    M -=1

print(-sum(nums))

Measured memory_bytes: 14180
def resolve():
    citys_num, k = map(int, input().split())
    cities = list(map(int, input().split()))

    visited = set()
    route = []
    isAgain = False
    currectCity = 1
    while not isAgain:
        if currectCity in visited:
            route.append(currectCity)

            isAgain = True
        else:
            visited.add(currectCity)
            route.append(currectCity)

            currectCity = cities[currectCity - 1]
    if len(route) > k:
        print(route[k])
        return
    loopstart = route.index(route[-1])
    loop = route[loopstart:-1]

    k = k - loopstart
    k = k % len(loop)

    print(loop[k])
resolve()

Measured memory_bytes: 124616
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
const int MAX_N=1e+6;
int bit[MAX_N+1], n;
int sum(int i){
    int s=0;
    while(i>0){
        s+=bit[i];
        i-=i&-i;
    }
    return s;
}
void add(int i,int x){
    while(i<=n){
        bit[i]+=x;
        i+=i&-i;
    }
}

int main(void){
    ll m;cin>>n>>m;
    vector<pair<int,int>> p(m);
    rep(i,m){
        cin>>p[i].second>>p[i].first;
        p[i].first--;p[i].second--;
    }
    sort(p.begin(),p.end());
    int res=0;
    rep(i,m){
        int a=p[i].second,b=p[i].first;
        ll sa=sum(a),sb=sum(b);
        if(sa==sb){
            add(b,1);
            res++;
        }
    }
    cout<<res<<endl;
}

Measured memory_bytes: 4532
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int x;
    cin>>x;
    if(x>=30)
       cout<<"Yes\n";
    else
       cout<<"No\n";
    return 0;
}

Measured memory_bytes: 3636
w = gets.to_s

ch = "a"
n = 0
while true
	n = w.count(ch)
	if (n % 2 == 1)
		puts "No"
		exit
	end
	if (ch == "z")
		puts "Yes"
		exit
	end
	ch.succ!
	# next! でも良いらしい
end





Measured memory_bytes: 1788
a, s = [0]*100003, [0]*100003
while True:
	n, k = map(int, input().split())
	if n == 0: break
	s[0] = a[0] = int(input())
	for i in range(1, n):
		a[i] = int(input())
		s[i] = s[i-1] + a[i]
		if i >= k: s[i] -= a[i-k]
	ans = s[k-1]
	for i in range(k, n):
		if s[i] > ans: ans = s[i]
	print(ans)


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

int main()
{
    string str;
    cin >> str;

    vector<int> v((int)str.length());
    int oddCnt = 0;
    int eveCnt = 0;
    int addres = 0;
    char preb = 'R';
    for(int i = 0; i < (int)str.length(); ++i)
    {
        char c = str[i];
        switch(c)
        {
            case 'R':
                if(i%2==0)
                {
                    eveCnt += 1;
                }
                else
                {
                    oddCnt += 1;
                }
                break;
            case 'L':
                if(preb == c)
                {
                    if(i%2==addres%2)
                    {
                        v[addres] += 1;
                    }
                    else
                    {
                        v[addres-1] += 1;
                    }
                }
                else
                {
                    addres = i;
                    if(i%2==0)
                    {
                        v[addres] += eveCnt+1;
                        v[addres-1] += oddCnt;
                    }
                    else
                    {
                        v[addres] += oddCnt+1;
                        v[addres-1] += eveCnt;
                    }
                    eveCnt = 0;
                    oddCnt = 0;
                }
            break;
        }
        preb = c;
    }

    bool ini = true;
    for(int num : v)
    {
        if(!ini)
        {
            cout << " ";
        }
        cout << num;
        ini = false;
    }
}

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

int main() {
    int x,a;
    cin >> x >> a;
    if(x < a) cout << "0" << endl;
    else cout << "10" << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define ll long long
#define vec vector < ll >
#define pb push_back
#define po pop_back
#define f(i,x,n) for(ll i=x;i<n;i++)
#define rf(i,x,n) for(ll i = x; i >= n; i--)
#define all(c) c.begin(),c.end()
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 2e3 + 10; 
int main()
{   ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  	int s,w;cin>>s>>w;
  	if(w>=s) cout<<"unsafe";
  	else cout<<"safe";
	return 0;
}

Measured memory_bytes: 3660
function Scanner(input) {
	var self = this;
	self.itemNo = 0;
	self.orgStr = input;
	self.splitedStrs = (function(target) {
		var result = [];
		var target = target.replace(/[\n \t]+/g, " ");
		var strs = target.split(" ");
		for (var i = 0, len = strs.length; i < len; i++) {
			result.push(strs[i]);
		}
		return result;
	}(input));

	self.next = function() {
		var result = self.splitedStrs[self.itemNo];
		self.itemNo++;
		return (result != null) ? result : null;
	}

	self.nextInt = function() {
		var result = self.splitedStrs[self.itemNo];
		self.itemNo++;
		return (result != null) ? parseInt(result) : null;
	}

	self.nextBigDecimal = function() {
		var result = self.splitedStrs[self.itemNo];
		self.itemNo++;
		return (result != null) ? parseFloat(result) : null;
	}
	
	self.nextByte = function() {
		var result = self.splitedStrs[self.itemNo];
		self.itemNo++;
		return (result != null) ? new Int8Array(result) : null;
	}

}

function Main(sc) {

	var N = sc.nextInt();
	var M = sc.nextInt();
	var Q = sc.nextInt();
	
	var abcds = [];
	var point = 0;
	var wkPoint = 0;
	
	for (var i = 0; i < Q; i++) {
		var abcd = {
				a:sc.nextInt(),
				b:sc.nextInt(),
				c:sc.nextInt(),
				d:sc.nextInt(),
		};
		abcds.push(abcd);
	}
	
	var array = [];
	for (var i = 0; i < N; i++) {
		array.push(1);
	}
	
	var doEnd = false;
	for (var a = 0; a < Math.pow(M, N); a++) {
		
		if (a != 0) array[N - 1]++;
		for (var b = N - 1; b >= 0; b--) {
			if (array[b] > M) {
				if (b == 0) {
					doEnd = true;
					break;
				}
				array[b - 1]++;
				var newMin = array[b - 1];
				for (var c = b; c < array.length; c++) {
					array[c] = newMin;
				}
			}
		}
		if (doEnd) break;
		
		wkPoint = 0;
		for (var i = 0; i < abcds.length; i++) {
			if (abcds[i].c == array[abcds[i].b - 1] - array[abcds[i].a - 1]) {
				wkPoint += abcds[i].d;
			}
		}
		if (point < wkPoint) point = wkPoint;
	}
	
	console.log(point);
}
Main(new Scanner(require("fs").readFileSync("/dev/stdin", "utf8")));
// Main(new Scanner("33"));

// var str1 = sc.next(); // Stringで取得
// var int1 = sc.nextInt(); // intで取得
// var bd1 = sc.nextBigDecimal(); // BigDecimalで取得
// var byte1 = sc.nextByte(); // byteで取得


Measured memory_bytes: 32604
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>
#include <random>
#include <stdio.h>
#include <iostream>
#include <set>
#include <algorithm>
#include <iterator>
using namespace std;

typedef long long LL;
typedef long double LD;
typedef string ST;


#define REP(i,n) for(LL (i)=0;(i)<(n);(i)++)
#define ALL(v) v.begin(), v.end()
#define PRINTLN(v) for(auto (a): v )   cerr << a << endl
#define PRINTSP(v) for(auto (a): v ) {cerr << a << " ";} cerr << endl

LL GCD(LL m, LL n) {

  if (m < n) {
    swap(m, n);
  }

  //while (n != 0) {
  while (n != 0) {
    cerr << n << " " << m << endl;
    LL n_new = m % n;
    m = n;
    n = n_new;
  }

  return m;

}

bool isPrime(LL N)
{
  if (N < 2) {
    return false;
  }
  else if (N == 2) {
    return true;
  }
  else if (N % 2 == 0) {
    return false;
  }

  LD sqrtNum = sqrt(N);
  for (LL i = 3; i <= sqrtNum; i += 2)
  {
    if (N % i == 0)
    {
      return false;
    }
  }
  return true;
}

void func() {
  LL A, B;
  cin >> A >> B;
  
  LL i = 1;
  set<LL> SA;
  set<LL> SB;
  while (i * i <= A) {
    if (A % i == 0) {
      //cerr << i << endl;
      //cerr << N/i << endl;
      SA.insert(i);
      SA.insert(A / i);
    }
    i++;
  }

  i = 1;
  while (i * i <= B) {
    if (B % i == 0) {
      //cerr << i << endl;
      //cerr << N/i << endl;
      SB.insert(i);
      SB.insert(B / i);
    }
    i++;
  }
  set<LL> S;
  set_intersection(ALL(SA), ALL(SB), std::inserter(S, S.end()));

  LL cnt = 0;
  for (auto s : S) {
    //cerr << s << endl;
    if (isPrime(s)) {
      cnt++;
      //cerr << s << endl;
    }
  }
  cout << cnt + 1;

}

#ifdef CALC_TIME 
#include <windows.h>
int main()
{
  LARGE_INTEGER freq;
  QueryPerformanceFrequency(&freq);
  LARGE_INTEGER start, end;
  QueryPerformanceCounter(&start);
  // 何かの処理
  func();
  QueryPerformanceCounter(&end);
  double time = static_cast<double>(end.QuadPart - start.QuadPart) * 1000.0 / freq.QuadPart;
  fprintf(stderr, "\n%lf[ms]\n", time);
  return 0;
}
#else 
int main()
{
  func();
  return 0;
}
#endif





Measured memory_bytes: 1152
#include <iostream>
#include <unordered_set>

using namespace std;
typedef long long ll;

int main(){
    ll n;
    cin >> n;
    unordered_set<ll> num;
    for(int i = 0; i < n; ++i){
        ll a;
        cin >> a;
        if(num.count(a)){
            num.erase(a);
        }else{
            num.insert(a);
        }
    }
    cout << num.size() << endl;
    return 0;
}


Measured memory_bytes: 4256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }
    

    Scanner cin;

    

    void calc()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        cin.next();
        string[] S = new string[N];
        for (int i = 0; i < N; i++)
        {
            S[i] = cin.next();
        }
        Array.Sort(S);
        Console.WriteLine(string.Join("", S));
    }
}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

Measured memory_bytes: 11488
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] a = new int[n];
    int max = -10000000;
    int min = 10000000;
    int idx1 = 0;
    int idx2 = 0;
    for(int i=0;i<n;i++){
      a[i]=sc.nextInt();
      if(a[i]>=max){
        max=Math.max(max,a[i]);
        idx1=i+1;
      }
      if(a[i]<=min){
        min=Math.min(min,a[i]);
        idx2=i+1;
      }
    }
    if(Math.abs(max)>=Math.abs(min)){
      System.out.println(2*n-1);
      for(int i=0;i<n;i++){
        System.out.println(idx1+" "+(i+1));
      }
      for(int i=1;i<n;i++){
        System.out.println(i+" "+(i+1));
      }
    }else{
      System.out.println(2*n-1);
      for(int i=0;i<n;i++){
        System.out.println(idx2+" "+(i+1));
      }
      for(int i=n-1;i>=1;i--){
        System.out.println((i+1)+" "+i);
      }
    }
  }
}

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

struct Node {
    int key;
    struct Node *next, *prev;
};

struct Node *nil;

struct Node *listSearch(int key)
{
    struct Node *cur = nil->next;

    while (cur != nil && cur->key != key) {
        cur = cur->next;
    }
    return cur;
}

void init()
{
    nil = (struct Node *)malloc(sizeof(struct Node));
    nil->next = nil;
    nil->prev = nil;
}

void printList()
{
    struct Node *cur = nil->next;
    int isf = 0;

    while (1) {
        if (cur == nil) break;
        if (isf++ > 0) printf(" ");
        printf("%d", cur->key);
        cur = cur->next;
    }
    printf("\n");
}

void deleteNode(struct Node *t)
{
    if (t == nil) return;
    t->prev->next = t->next;
    t->next->prev = t->prev;
    free(t);
}

void deleteFirst()
{
    deleteNode(nil->next);
}

void deleteLast()
{
    deleteNode(nil->prev);
}

void deleteKey(int key)
{
    deleteNode(listSearch(key));
}

void insert(int key)
{
    struct Node *x = (struct Node *)malloc(sizeof(struct Node));

    x->key = key;
    x->next = nil->next;
    nil->next->prev = x;
    nil->next = x;
    x->prev = nil;
}

int main()
{
    int key, n, i;
    int size = 0;
    char command[20];
    int np = 0, nd = 0;

    init();

    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%s%d", command, &key);
        if (strcmp(command, "insert") == 0) {
            insert(key);
            np++;
            size++;
        } else if (strcmp(command, "delete") == 0) {
            deleteKey(key);
            nd++;
            size--;
        } else if (strcmp(command, "deleteFirst") == 0) {
            deleteFirst();
            size--;
        } else if (strcmp(command, "deleteLast") == 0) {
            deleteLast();
            size--;
        }
    }

    printList();

    return 0;
}


Measured memory_bytes: 32968
#include <bits/stdc++.h>
#define endl '\n'
#define debug(X) cout << #X << " = " << X << endl

using namespace std;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	#ifdef UTP
	freopen("input.txt", "r", stdin);
	#endif
	long long a, b, c, k; cin >> a >> b >> c >> k;
	if (k % 2) cout << b - a << endl;
	else cout << a - b << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	int ii=1,f=0;
	long long temp1=1;
	long long a,temp2;
	cin>>n;
	for(ii=1;ii<=n;ii++)
	{
		cin>>a;
		if(f==0)
		{
			temp2=temp1*a;
			if(temp2<temp1 && a!=0)
			{	
				temp1=-1;
				f=1;
			}
			else
				temp1=temp2;			
		}
		else
		{
			if(a==0)
			{
				cout<<0;
				return 0;				
			}
				
			else
				temp1=temp1;
		}	
	}
	
	if(temp1>1000000000000000000)
		cout<<-1;
	else
		cout<<temp1;			
	return 0;
}

Measured memory_bytes: 3636
#include<iostream>
using namespace std;
int main()
{
  string s;
  cin>>s;
  int c=0,a=0,b=0;
  if(s[0]==s[1])
  {
    c++;
  }
  if(s[0]==s[2])
  {
    c++;
  }
  if(s[0]==s[3])
  {
    c++;
  }
  if(s[1]==s[2])
  {
    a++;
  }
  if(s[1]==s[3])
  {
    a++;
  }
  if(s[2]==s[3])
  {
   b++;
  }
  if(c==1 && b==1)
     {
       cout<<"Yes\n";
     }
     else if(c==1 && a==1)
     {
       cout<<"Yes\n";
     }
      else if(a==1 && b==1)
     {
       cout<<"Yes\n";
     }
     else{
       cout<<"No\n";
       }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int X,Y;
char map[10][10000];

int input(){
	cin >> X >> Y;
	if(X == 0 && Y == 0) return false;
	for(int i = 0;i < X;++i){
		for(int j = 0;j < Y;++j){
			cin >> map[i][j];
		}
	}
	return true;
}

int main(){
	while(input()){
		int res = 0;
		for(int k = 0;k < (1 << X);++k){
			int crt_res = 0;
			for(int j = 0;j < Y;++j){
				int res0 = 0,res1 = 0;
				for(int i = 0;i < X;++i){
					if((k>>i)&1){
						if(map[i][j] == '1') ++res0;
						else ++res1;
					}else{
						if(map[i][j] == '1') ++res1;
						else ++res0;
					}
				}
				res0 = (res0 > res1 ? res0 : res1);
				crt_res += res0;
			}
			res = (crt_res > res ? crt_res : res);
		}
		cout << res << endl;
	}
	return 0;
}


Measured memory_bytes: 3196
def main():
    K = int(input())

    ans = editorial(K)
    assert ans == AC(K)
    print(ans)


def editorial(K):
    return (K // 2) * ((K + 1) // 2)


def AC(K):
    d = {}
    for i in range(1, K+1):
        for j in range(i+1, K+1):
            p = tuple(sorted((i, j)))
            if i % 2 == 1 and j % 2 == 0:
                d[p] = 1
            elif i % 2 == 0 and j % 2 == 1:
                d[p] = 1

    ans = len(d)
    return ans


if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#![allow(unused_imports)]
#![allow(unused_variables)]
use proconio::input;
use proconio::marker::*;
use std::cmp::{min, max};
use std::collections::{HashSet, HashMap, BinaryHeap};

fn main() {
    input! {
        n: usize,
        mut a: [u64; n],
    }
    a.sort();
    if a[0] == 0{
        println!("{}", 0);
        return;
    }
    let mut ans = 1;
    for &i in a.iter(){
        if ans > (1e18 as u64) / i{
            println!("{}", -1);
            return;
        }else{
            ans *= i;
        }
    }
    println!("{}", ans);
}


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

int main(){
    int n;

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

    int point_a = 0, point_b = 0;

    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());

    

    for(int i = 0; i < n; i++){
        if(i % 2 == 0){
            point_a = point_a + a[i];
        }
        else{
            point_b = point_b + a[i];
        }
    }

   
    printf("%d\n", point_a - point_b);

    return 0;

}

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


void solve(long long N, std::vector<long long> X, std::vector<long long> L){
    vector<array<ll, 3>> rxl(N);
    REP(i, N){
        rxl.at(i).at(0) = X.at(i) + L.at(i);
        rxl.at(i).at(1) = X.at(i);
        rxl.at(i).at(2) = L.at(i);
    }
    sort(rxl.begin(), rxl.end());
    ll cur_right = numeric_limits<ll>::min();
    ll ans = 0;
    REP(i, N){
        if(rxl.at(i).at(1) - rxl.at(i).at(2) >= cur_right){
            ans++;
            cur_right = rxl.at(i).at(0);
        }
    }
    cout << ans << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> X(N);
    std::vector<long long> L(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&X[i]);
        scanf("%lld",&L[i]);
    }
    solve(N, std::move(X), std::move(L));
    return 0;
}


Measured memory_bytes: 4096
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <numeric>
#include <stack>

using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);
typedef unordered_map<ll, ll> ump;
typedef pair<ll, ll> P;

ump mp;

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
        mp = ump();
#pragma clang diagnostic pop
#endif
        int H, W, h, w;
        cin >> H >> W >> h >> w;
        H, W;
        h--, w--;
        int ans = 0;
        rep(i, W) {
            rep(j, H) {
                if (i > w && j > h) ans++;
            }
        }
        cout << ans << endl;


#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 256
N = int(input())
route = list(map(int, input().split()))
satisfaction = list(map(int, input().split()))
plus_s = list(map(int, input().split()))

ans = 0
route_cnt = None
for i in range(N):
    a = route[i]
    ans += satisfaction[a - 1]
    if route_cnt is None:
        route_cnt = a
        continue
    if a - route_cnt == 1:
        ans += plus_s[route[i] - 2]
    route_cnt = a
print(ans)


Measured memory_bytes: 3060
#!/usr/local/bin python
# -*- coding: utf-8 -*-
#
# ~/PycharmProjects/atcoder/B-CardgameForThreeEasy.py
#
sa = input()
sb = input()
sc = input()


def game_action(next_person, sa, sb, sc):
    if next_person == "a":
        if sa == "":
            print("A")
            exit()
        next_person = sa[0]

        sa = sa[1:]
        # sb = sb
        # sc = sc
        return game_action(next_person, sa, sb, sc)
    elif next_person == "b":
        if sb == "":
            print("B")
            exit()
        next_person = sb[0]

        # sa = sa
        sb = sb[1:]
        # sc = sc
        return game_action(next_person, sa, sb, sc)
    elif next_person == "c":
        if sc == "":
            print("C")
            exit()
        next_person = sc[0]
        # sa = sa
        # sb = sb

        sc = sc[1:]
        return game_action(next_person, sa, sb, sc)


game_action(sa[0], sa[1:], sb, sc)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define pb push_back
#define sz(a) (int)(a.size())
#define x first
#define y second
using namespace std;
const int MAXV = 405;
const int MAXT = 10005;
vector<pair<int, int> > g[MAXV];
int id[MAXT] , dst[MAXT] , Tmax , n , m;
void inputG()
{
	cin >> n >> m;
	for(int i = 0; i < m; i++) {
		int u, v, d; cin >> u >> v >> d;
		u--; v--;
		g[u].push_back({v, d});
		g[v].push_back({u, d});
	}
}
void inputQueries()
{
	
	cin >> Tmax;
	memset(id , -1 , sizeof id);
	for(int i = 0; i < Tmax; i++) {
		int Nnew; cin >> Nnew;
		for(int j = 0; j < Nnew; j++) {
			cin >> id[i] >> dst[i];
		}
	}
}
vector<pair<int , int> > spanTree[MAXV];
int p[MAXV];
int find(int u)
{
	return p[u] = p[u] == u ? u : find(p[u]);
}
void unite(int u , int v , int c)
{
	int U = find(u) , V = find(v);
	if(U != V)
	{
		p[V] = U;
		spanTree[u].pb({v , c});
		spanTree[v].pb({u , c});
	}
}

void buildSpan()
{
	for(int u = 0; u < n; u++)p[u] = u;
	vector<pair<int , pair<int , int> > > edges;
	for(int u = 0; u < n; u++)
		for(auto v : g[u])
			if(u < v.x)
				edges.pb({v.y , {u , v.x}});
	sort(edges.begin() , edges.end());
	for(auto e : edges)
		unite(e.y.x , e.y.y , e.x);
}

vector<int> route;
void dfs(int u , int p = -1)
{
	for(auto v : spanTree[u])
		if(v.x != p)
		{
			for(int i = 0; i < v.y; i++)
				route.pb(v.x);
			dfs(v.x , u);
			for(int i = 0; i < v.y; i++)
				route.pb(u);
		}
			
}
void findRoute()
{
	dfs(0);
}
int main() {
	inputG();
	inputQueries();
	buildSpan();
	findRoute();
	int cntStop = 400;
	for(int i = 0; i < Tmax; i++)
	{
		if(i < cntStop)
			cout << -1 << endl;
		else
			cout << route[(i - cntStop) % sz(route)] + 1 << endl;
	}
	return 0;
}


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

struct data
{
	string name;
	int score;
	int num;
};

bool cmp(data a,data b)
{
	if(a.name==b.name)
	{
		return a.score > b.score;
	}
	return a.name < b.name;
}

int arr[101];

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

	data d;
	vector <data> v;
	int n;

	cin >> n;

	for(int i=0;i<n;i++)
	{
		cin >> d.name >> d.score;
		d.num = i;
		v.push_back(d);
	}

	sort(v.begin(),v.end(),cmp);

	for(int i=0;i<n;i++)
	{
		cout << v[i].num+1 << '\n';

	}

	return 0;	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template <class T> ll size(const T &x) { return x.size(); }
#define rep(i,a,b) for(ll i = (a); i < (b); i++)
#define iter(it,c) for(auto it = (c).begin(); it != (c).end();++it)
#define pb push_back
#define fs first
#define sc second
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;

const ll INF = ~(1<<31);
const double pi = acos(-1);
const double EPS = 1e-9;

ll gcd(ll a, ll b) {return b == 0 ? a : gcd(b,a%b); }
ll lcm(ll a, ll b) { return a / gcd(a,b) * b; }

int main() {
    cin.sync_with_stdio(false);
	ll n,m;
	cin >> n >> m;
	string s,b;
	cin >> s >> b;
	ll val = lcm(n,m);
	unordered_map<ll,char> k;
	if(s[0] != b[0]) {
		cout << "-1" << endl;
		return 0;
	} else {
		rep(i,1,n) {
			k[i*(val/n)-1] = s[i];
		}
		rep(i,1,m) {
			if(k.find(i*(val/m)-1) != k.end()) {
				if(k[i*(val/m)-1] != b[i]) {
					cout << -1 << endl;
					return 0;
				}
			}
		}
		cout << val << endl;
	}
    return 0;
}



Measured memory_bytes: 4260
#include <iostream>
#include <utility>
#include <cmath>
#include <queue>
using namespace std;
bool check(int* cube) {
	for (int i = 1; i < 9; i++) {
		if (cube[i] != cube[0]) {
			return false;
		}
	}
	for (int i = 10; i < 12; i++) {
		if (cube[i] != cube[9] || cube[i + 3] != cube[12]) {
			return false;
		}
	}
	return true;
}

void turn(int* cube, int i) {
	switch (i) {
	case 0:
		for (int i = 0; i <= 6; i += 3) {
			swap(cube[i], cube[23 + i]);
		}
		swap(cube[20], cube[9]);
		swap(cube[15], cube[17]);
		break;

	case 1:
		for (int i = 0; i < 3; i++) {
			swap(cube[i], cube[27 + i]);
		}
		swap(cube[14], cube[15]);
		swap(cube[20], cube[18]);
		break;

	case 2:
		for (int i = 2; i <= 8; i += 3) {
			swap(cube[i], cube[19 + i]);
		}
		swap(cube[18], cube[11]);
		swap(cube[14], cube[12]);
		break;

	case 3:
		for (int i = 6; i <= 8; i++) {
			swap(cube[i], cube[15 + i]);
		}
		swap(cube[17], cube[12]);
		swap(cube[9], cube[11]);
		break;
	default:break;
	}
}

struct Cube{
	public:
	Cube(){count = 0; moved = -1;}
	int cube[30];
	int count;
	int moved;
};

int main(){
	int n = 0;
	cin >> n;
	for(int i = 0; i < n; i++){
		Cube origin;
		for(int j = 0; j < 30; j++){
			cin >> origin.cube[j];
		}
		queue<Cube> q;
		q.push(origin);
		int count = 0;
		while(!q.empty()){
			Cube current = q.front();
			q.pop();
			if(check(current.cube)){
				cout << current.count << endl;
				break;
			}
			current.count++;
			for(int i = 0; i < 4; i++){
				if(current.moved != i){
					Cube temp = current;
					turn(temp.cube, i);
					temp.moved = i;
					q.push(temp);
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3900
#include<bits/stdc++.h>
using namespace std;
int main () {
    int a, b, c;
    cin >> a >> b >> c;
    if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) cout << "Possible";
    else cout << "Impossible";
}

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

using namespace std;
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

ll lcm(ll a, ll b) {
    return a / __gcd(a, b) * b; 
}

void solve() {
    int N;
    cin >> N;
    if (N == 2) {
        cout << "4 7" << endl;
        cout << "23 10" << endl;
        return;
    }

    vector<int> isprime(10001, 1);
    isprime[0] = isprime[1] = 0;
    for(int i = 0; i < 10001; i++) {
        if (isprime[i]) {
            for(int j = i + i; j < 10001; j += i) {
                isprime[j] = 0;
            }
        }
    }
    vector<ll> primes;
    for (int i = 0; i < 10001; i++) {
        if (isprime[i]) {
            primes.push_back(i);
        }
    }

    vector<vector<ll>> P1(N, vector<ll>(N)), P2(N, vector<ll>(N));
    vector<vector<ll>> ans(N, vector<ll>(N));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if ((i + j) % 2 == 0) {
                ll p1 = primes[(i + j) / 2];
                ll p2 = primes[primes.size() - 1 - (i - j + N) / 2];
                ans[i][j] = p1 * p2;
            }
        }
    }
    int dx[] = {1, 0, -1, 0};
    int dy[] = {0, -1, 0, 1};
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if ((i + j) % 2 == 1) {
                ll l = 1;
                for(int k = 0; k < 4; k++) {
                    int di = i + dy[k];
                    int dj = j + dx[k];
                    if (di < 0 || di >= N || dj < 0 || dj >= N) continue;
                    l = lcm(l, ans[di][dj]);
                }
                ans[i][j] = l + 1;
            }
        }
    }
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cout << ans[i][j] << " ";
        }
        cout << endl;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}

Measured memory_bytes: 9216
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <numeric>
#include <random>
#include <vector>
#include <array>
#include <bitset>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
 
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;

int main() {
    int a[100];
    int g = 0;
    for(int i = 0; i < 5; i++){
        cin >> a[i];
        g++;
        if(a[i] == 0){
            cout << g;
        }
    }
    
    
    
    
    return 0;
}

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

S = input()[:-1]
dp = [[0]*4 for _ in range(len(S)+1)]
dp[0][0] = 1
MOD = 10**9+7

for i in range(len(S)):
    dp[i+1][0] = dp[i][0]*(3 if S[i]=='?' else 1)%MOD
    dp[i+1][1] = (dp[i][1]*(3 if S[i]=='?' else 1)+(dp[i][0] if S[i] in ['A', '?'] else 0))%MOD
    dp[i+1][2] = (dp[i][2]*(3 if S[i]=='?' else 1)+(dp[i][1] if S[i] in ['B', '?'] else 0))%MOD
    dp[i+1][3] = (dp[i][3]*(3 if S[i]=='?' else 1)+(dp[i][2] if S[i] in ['C', '?'] else 0))%MOD
    
print(dp[-1][3])

Measured memory_bytes: 84460
#include <iostream>

 

using namespace std;

 

int main()
{
   int a, b, c, i;
   for(i=1; i<=3000; i++)
   {
   cin >> a >> b;
   
   if(a > b)
   {
   c = a;
   a = b;
   b = c;
   }
   
   if(0 == a && 0 == b){
     break;
   }

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


Measured memory_bytes: 3000
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(obj)   (obj).begin(),(obj).end()

#define debug(var)  do{std::cout << __LINE__ << "> " << #var << ": ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

void Main() {
	int N; cin >> N;
	vector<int> P(N);
	vector<int> Q(N);
	REP(i,N) cin >> P[i];
	REP(i,N) cin >> Q[i];
	vector<int> vec(N);
	REP(i, N) vec[i] = i + 1;
	int p, q;
	int cnt = 1;
    do {
		bool p_match = true;
		bool q_match = true;
		REP(i, N) {
			if (vec[i] != P[i]) p_match = false;
			if (vec[i] != Q[i]) q_match = false;
		}
		if (p_match) p = cnt;
		if (q_match) q = cnt;
		++cnt;
    } while (next_permutation(vec.begin(), vec.end()));
	cout << abs(p - q) << endl;
}

int main() {
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pq priority_queue
using namespace std;
constexpr long long gcd(long long a, long long b){return b ? gcd(b, a % b) : a;}
constexpr long long lcm(long long a, long long b){return a / gcd(a, b) * b;}
constexpr int INF = 1e9, MOD = INF + 7, around[] = {0, 1, 1, -1, -1, 0, -1, 1, 0, 0};
constexpr int mod_pow(long long x, long long n, const int mod){long long ret=1;while(n){if(n&1)(ret*=x)%=mod;(x*=x)%=mod;n>>=1;}return ret;}
template<int n> struct Prime{bool arr[n+1];constexpr bool operator[](int k){return arr[k];}constexpr Prime():arr(){for(int i=2;i<n;i++){arr[i]=true;for(int j=2;j*j<=i;j++){if(!(i%j))arr[i]=false;}}}};
template<int n> struct Factorial{long long arr[n+1],ary[n+1];constexpr Factorial():arr(),ary(){arr[0]=1;ary[0]=1;for(int i=0;i<n;i++){arr[i+1]=arr[i]*(i+1)%MOD;ary[i+1]=mod_pow(arr[i+1],MOD-2,MOD);}}};
constexpr Factorial<1010> fact; constexpr Prime<10> prime;
constexpr long long comb(int a, int b){if(a < b) return 0LL;if(!a or !b) return 1LL; long long pos = fact.arr[a], pot = fact.ary[a - b], por = fact.ary[b]; return pos * pot % MOD * por % MOD;}
template<int n> struct Bernoulli{long long arr[n+1];constexpr Bernoulli():arr(){arr[0]=1;for(int i=1;i<=n;i++){long long sum=0;for(int j=0;j<i;j++){(sum+=comb(i+1,j)*arr[j]%MOD)%=MOD;}arr[i]=(MOD-mod_pow(i+1,MOD-2,MOD))%MOD*sum%MOD;}}};
constexpr int vx[] = {1, 0, -1, 0}, vy[] = {0, 1, 0, -1};
constexpr long double PI = abs(acos(-1));
constexpr int sqrtN = 512, logN = 32;
constexpr long long LINF=1e18;

long long solve(long long x){
	long long ok = 0, ng = INF;
	
	while(abs(ng - ok) > 1){
		long long mid = (ok + ng) / 2;
		
		if(mid * mid < x) ok = mid;
		else ng = mid;
	}
	
	return ok;
}

int main(){
	int n; cin >> n;
	for(int i = 0; i < n; i++){
		long long a, b; cin >> a >> b;
		long long ans = solve(a * b);
		
		if(a == b) ans = (a - 1) * 2;
		else if(a + 1 == b) ans = (a - 1) * 2;
		else if(b + 1 == a) ans = (b - 1) * 2;
		else if(ans * (ans + 1) >= a * b) ans = 2 * ans - 2;
		else ans = ans * 2 - 1;
		
		cout << ans << endl;
	}
	
	return 0;
}


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

using namespace std;

#define int long long
#define nl '\n'

#define st first
#define nd second
#define ins insert

#define pb push_back
#define mp make_pair

#define hashmap unordered_map
#define hashset unordered_set

signed main(){
	int x, n; cin >> x >> n; hashset<int> s;
	for (int i = 0; i < n; i++){
		int j; cin >> j; s.ins(j);
	}
	int c1 = x, c2 = x;
	while (s.count(c1) == 1){
		c1--;
	}
	while (s.count(c2) == 1){
		c2++;
	}
	if (abs(x - c1) <= abs(x - c2)){
		cout << c1;
	} else cout << c2;
}


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

typedef long long ll;
const int len = 5005;
int arr[len];
bool pref[len][len], suf[len][len];

int main(){
    int n, k;
    scanf("%d %d", &n, &k);
    for (int i = 1; i <= n; i++)
        scanf("%d", &arr[i]);

    pref[0][0] = suf[n+1][0] = true;
    for (int i = 1; i <= n; i++)
        for (int j = k; j >= 0; j--)
            if (pref[i-1][j] == true)
                pref[i][j] = pref[i][min(k, j+arr[i])] = true;

    for (int i = n; i >= 1; i--)
        for (int j = k; j >= 0; j--)
            if (suf[i+1][j] == true)
                suf[i][j] = suf[i][min(k, j+arr[i])] = true;

    //for (int j = 0; j <= k; j++)
      //  printf("sum = %d, pref = %d, suf = %d\n", j, pref[n][j], suf[1][j]);

    int ans = 0;
    for (int i = 1; i <= n; i++){
        int un = 1;
        for (int a = k-1, b = 0, mx = 0; a >= 0; a--){
            if (pref[i-1][a] == false)
                continue;

            while (b < k-1-a){
                b++;
                if (suf[i+1][b])
                    mx = b;
            }

            //printf("a = %d, mx = %d\n", a, mx);

            if (mx+a+arr[i] >= k)
                un = 0;
        }

        ans += un;
        //printf("i = %d, up = %d, un = %d\n", i, up, un);
    }

    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 49152
#include <iostream>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <float.h>
#include <limits>
#include <vector> 
#include <string.h>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define ll long long
#define asort(a) sort(a.begin(),a.end());

using namespace::std;

int jo(ll int jxo, ll int jyo){//累乗
	ll int jhogeo = 1;
	rep(jinto,0,jyo) jhogeo=jhogeo*jxo;
	return jhogeo;
}
char tobig(char toxbig){//char大文字化
  return (toxbig-0x20);
}
char tolow(char toxlow){//char小文字化
  return (toxlow+0x20);
}
int ctoi(char cctoi){//char->int
  if('0' <= cctoi && cctoi <= '9') return (cctoi-'0');
  return -1;
}
int gcd(int gcad, int gcbd) {//最大公約数
  if(gcad < gcbd) return gcd(gcbd, gcad);
  int gcrd;
  while ((gcrd=gcad%gcbd)) {
    gcad = gcbd;
    gcbd = gcrd;
  }
  return gcbd;
}
int lcm(int lcam, int lcbm){//最小公倍数
 return (lcam*lcbm)/gcd(lcam,lcbm);
}


int main(){
  int w,a,b;
  cin>>w>>a>>b;
  if(b+w<a){
    cout<<a-(b+w);
  }else if(a+w<b){
    cout<<b-(a+w);
  }else{
    cout<<0;
  }

}

// int *p = new int[N];

//  vector<int> 変数名(要素数);
//  sort(変数名.begin(),変数名.end());//昇順ソート

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//


Measured memory_bytes: 256
#include <iostream>
 
using namespace std;
 
class Die {
  public:
  int f1, f2, f3, f4, f5, f6;
    Die(int f1, int f2, int f3, int f4, int f5, int f6)
      :f1{f1}, f2{f2}, f3{f3}, f4{f4}, f5{f5}, f6{f6} {}
  Die N() {  // "North roll"
    return Die(f2, f6, f3, f4, f1 ,f5);
  } 
  Die E() {  // "East roll"
    return Die(f4, f2, f1, f6, f5, f3);
  } 
  Die rotCW() { // Clockwise rotation in place
                 // while preserving top and bottom
    return Die(f1, f3, f5, f2, f4, f6);
  }

};

bool operator==(Die d, Die d2) {
  return (d2.f1 == d.f1 and 
      d2.f2 == d.f2 and d2.f4 == d.f4 and d2.f5 == d.f5 and d2.f6 == d.f6
      and d.f3 == d2.f3);
}

int main()
{
  int f1, f2, f3, f4, f5, f6;
  cin >> f1 >> f2 >> f3 >> f4 >> f5 >> f6;
  Die d(f1, f2, f3, f4, f5, f6);
  cin >> f1 >> f2 >> f3 >> f4 >> f5 >> f6;
  Die d2(f1, f2, f3, f4, f5, f6);

  // brute force: try all configurations
  for (int i = 0; i < 6; ++i) {
    Die dd = d;
    for (int j = 0; j < 6; ++j) {
      Die ddd = dd;
      for (int k = 0; k < 6; ++k) {
        if (ddd == d2) {
          cout << "Yes\n";
          return 0;
        }
        ddd = ddd.rotCW();
      }
      dd = dd.E();
    }
    d = d.N();
  }
  cout << "No\n";
}


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

#define _GLIBCXX_DEBUG

int main() {
  int n, m, count = 0;
  vector<int> h(200000);
  vector<int> a(200000);
  vector<int> b(200000);
  vector<int> c(200000);
  
  
  cin >> n >> m;
  
  for(int i = 0; i < n; i++) {
    cin >> h[i];
  }
   for(int i = 0; i < m; i++) {
    cin >> a[i] >> b[i];
  }
  
  for(int i = 0; i < m; i++) {
    if(h[a[i]-1] < h[b[i]-1]) {
      if(c[b[i]] != -1) {
        c[b[i]] = 0;
      }
      c[a[i]] = -1;
    }
    else if(h[a[i]-1] > h[b[i]-1]) {
      if(c[a[i]] != -1) {
        c[a[i]] = 0;
      }
      c[b[i]] = -1;
    }
    else if(h[a[i]-1] == h[b[i]-1]) {
      c[a[i]] = -1;
      c[b[i]] = -1;
    }
//    cout << c[a[i]] << " " << c[b[i]] << endl;
  }
  
  for(int i = 1; i <= n; i++) {
    if(c[i] == 0) count++;
  }
  
  cout << count << endl;
  
/*  cout << endl;
  for(int i = 1; i <= n; i++) {
   cout << c[i] << endl;
  }*/
}

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

int gao(int x, int y) {
  int tmp = max(x+y, x-y);
  return max(tmp, x*y);
}

int main() {
  int a, b;
  while (cin >> a >> b) {
    cout << gao(a, b) << endl;
  }
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define db(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<'\n'
const int N = 2e5+9;

template <unsigned M> struct modular {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
  static constexpr unsigned mod = M;
  using m = modular;
  unsigned v;
  modular(long long x = 0) : v((x %= mod) < 0 ? x + mod : x) {}
  m operator-() const { return m() -= *this; }
  m& operator+=(m b) { if ((int)(v += b.v - mod) < 0) v += mod; return *this; }
  m& operator-=(m b) { if ((int)(v -= b.v) < 0) v += mod; return *this; }
  m& operator*=(m b) { v = (uint64_t)v * b.v % mod; return *this; }
  m& operator/=(m b) { return *this *= power(b, mod - 2); }
  friend m operator+(m a, m b) { return a += b; }
  friend m operator-(m a, m b) { return a -= b; }
  friend m operator*(m a, m b) { return a *= b; }
  friend m operator/(m a, m b) { return a /= b; }
  friend bool operator==(m a, m b) { return a.v == b.v; }
#pragma GCC diagnostic pop
};
using mint = modular<int(1e9+7)>;

ll A[N], B[N];
int main() {
    ios_base::sync_with_stdio(0);
    ll a,b,T,cas=0;
    int n, k;
    cin>>n>>k;
    for(int i=1;i<=n+1;++i) {
        A[i]=A[i-1]+(i-1);
    }
    B[n+1]=n;
    for(int i=n;i>0;--i) {
        B[i]=B[i+1]+(i-1);
    }
    // for(int i=1;i<=n+1;++i)    cerr<<B[i]<<" ";
    mint s=0;
    for(int i=k;i<=n+1;++i) {
    	// cerr<<i<<" "<<A[i]<<" "<<B[n+1-i+1]<<endl;
        s += B[n+1-i+1]-max(0ll, A[i]-1);
        cerr<<s.v<<endl;
        // cerr<<s.v<<endl;
    }
    if(k==1) s+=1; // including 0
    cout<<s.v<<endl;
    return 0;
}

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

void solve(long long N, std::vector<std::string> s){
    long long result = 0LL;
    unordered_map<string, int> cache;
    for(int n = s.size(), i=n-1; i>=0; --i){
        vector<int> chars(26, 0);
        for (auto& c: s[i]){
            chars[c-'a']++;
        }
        string tmp;
        for (int i=0;i<26; ++i){
                tmp += to_string(chars[i]) + "_";
        }
        result += cache[tmp];
        cache[tmp]+=1;
    }
    printf("%lld", result);
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<std::string> s(N);
    for(int i = 0 ; i < N ; i++){
        std::cin >> s[i];
    }
    solve(N, std::move(s));
    return 0;
}


Measured memory_bytes: 23844
//「全問解く」:1一問も解かない」:0 としてBIT全探索→scoreに値を代入
//例.d=4,i=1011なら「100点、200点、400点の問題を全部解く」
//もしscoreがgに満たなかったら、iのビットを桁が大きいほうからしらべて0ならばその得点の問題を1問ずつ解く
//一問解くたびにscore>=gを確認し、真なら最小値と比較、最小値を下回れば更新しループを抜ける
//もし各回においてscore<gなら、p-1回まで行う
//このようなビットは高々1つでよい（p問解くならそのビットが1になっているのと同じである）
import java.util.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
    public static void main(String[] $) {
        Scanner sc = new Scanner(in);
        int d=sc.nextInt();
        int g=sc.nextInt();
        int[] p=new int[d+1];
        int[] c=new int[d+1];
        for (int i = 0; i < d; i++) {
            p[i+1]=sc.nextInt();
            c[i+1]=sc.nextInt();
        }
        int ans=1000000000;
        for (int i = 0; i < (1 << d); i++) {
            //temp:iを決めた時の回答数
            //score:iを決めた時の得点
            int temp=0;
            long score=0;
            for (int j = 0; j < d; j++) {
                if((1&(i>>j))==1) {
                    score += (j + 1) * 100 * p[j + 1] + c[j + 1];
                    temp += p[j + 1];
                }
            }
            if(score>=g){
                ans=min(ans,temp);
            }else {
                //高得点の問題から貪欲をする
                for (int j = d-1; j > -1; j--) {
                    if((1&(i>>j))==1)continue;
                    else {
                        for (int k = 1; k < p[j + 1]; k++) {
                            score += (j + 1) * 100;
                            temp += 1;
                            if(score>=g) {
                                ans = min(ans, temp);
                                break;
                            }
                        }
                        break;
                    }
                }
            }
        }
        out.println(ans);
    }
}

Measured memory_bytes: 23764
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>

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++)
#define FORR(i, m, n) for(int i = n;i >= m;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define ALL(n) n.begin(),n.end()

int main() {
	string a;
	cin >> a;
	a.erase(a.end() - 8, a.end());
	cout << a << endl;
}

Measured memory_bytes: 256