akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
 
using namespace std;
 
 
int main()
{	int n = 0;
 	int sum = 0;
 	cin>>n;
    vector<int> v;
 for(int i = 0;i<n;i++){
  int a = 0;
   cin>>a;
   v.push_back(a);
 }
    
int gensyou = 0;
 for(int i = n-1;i>0;i--){
if(v[i]>=v[i -1]){

}else if(v[i]>=v[i - 1] - 1 ){
 v[i - 1] =v[i - 1] -1;  
     
 }else{
 cout<<"No";
     return 0;
 }
 }
 cout<<"Yes";
}

Measured memory_bytes: 892
/**
  Queen Chess
*/
 
/* include */
#include <stdio.h>
#include <stdlib.h>
 
/* define */
#define MAX 8
#define BLACK 1 //queen exist
#define WHITE 0 //queen non-exist
#define TRUE 1
#define FALSE -1
 
/* prototype */
int search(int);
void printing();
 
/* global */
//X????????????Y?????¨???????JUDGE????????????ULLR(Upper Left, Lower Right)???URLL(Upper Right, Lower Left)
int X[MAX], Y[MAX], JUDGE[MAX][MAX], URLL[2*MAX-1], ULLR[2*MAX-1];
int top=1;
 
 
int main() {
  int i,j, k, r,c;
  /*?????????????????????*/
  //??????????????¨??????¨??????????
  for(i=0;i<MAX;i++){
    X[i] = WHITE;
    Y[i] = WHITE;
  }
  //??¬???????????????¨??????????
  for(i=0;i<2*MAX-1;i++){
    URLL[i] = WHITE;
    ULLR[i] = WHITE;
  }
  //??????????????????
  for(i=0;i<MAX;i++){
    for(j=0;j<MAX;j++){
      JUDGE[i][j] = FALSE;
    }
  }
 
  //input
  scanf("%d", &k); //?????????????????????¨???????????????°
  for(i=0;i<k;i++){
    scanf("%d %d",&r,&c); //r??????,c?????¨?
    JUDGE[r][c] = TRUE; //??????¨
  }
   
  //0????????????????????????????????????????????§?£??????¢??´?¢
  search(0);
   
  return 0;
}
 
/** ??????????????????????????????????????????????????????¢??´?¢
  * x??????????????????????????????????????????´??????x??????????????????????????????§?????????¨????????????
  * ??????????????????£??????????????????????????????????????????
  * ??????°?????????¨????????????¨???§?????????£????????????¶??????????????????????????????¨??????§??????
  */
int search(int x){
  int y;
  if(x==MAX) { //??????????????????§??????????????????°????????????¶??????°?????????§???..?????¶???????
    printing(); //??????????????????????????±???????£??????????????????¶????????????
    return 0;
  }
  for(y=0;y<MAX;y++){ 
    if(Y[y]==BLACK || URLL[x+y]==BLACK || ULLR[x-y+MAX-1]==BLACK){
      continue; //???¨????????????????????????????????¬????for()???
    }
    //x???????????????????????????????????????????????????????????\???¨??????¢????????????BLACK?????????
    X[x] = y; //<?\????>????????????¨??????...
    Y[y] = BLACK; //????????????
    URLL[x+y] = BLACK; //??????´????????????
    ULLR[x-y+MAX-1] = BLACK; //??????????????????
     
    //??¬?????????????¢??´?¢
    search(x+1); //<?\????>???????????¬?????????\????????§???????????????????...
     
    //???????????????????????????????????????
    X[x] = WHITE; //<?\????>??????????????\???§?????????????????????§??????...????????????????????????
    Y[y] = WHITE; //??????...
    URLL[x+y] = WHITE; //??????...
    ULLR[x-y+MAX-1] = WHITE; //????????????...
  }
  return 0;
}
 
/*??????*/
void printing(){
  int i,j;
  for(i=0;i<MAX;i++){
    for(j=0;j<MAX;j++){
      if(JUDGE[i][j] == TRUE) { //??????????????????????????????°
        if(X[i]!=j){
          return;
        }
      }
    }
  }
  for(i=0;i<MAX;i++) {
    for(j=0;j<MAX;j++) {
      if(X[i]==j) {
        printf("Q");
      }else{
        printf(".");
      }
    }
    printf("\n");
  }
}

Measured memory_bytes: 572
/* ****AWARE**** */

	#include<bits/stdc++.h>
	#include <limits.h> 
	#define cut ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
	#define ll          long long
	#define pb          push_back
	#define endl        '\n'
	#define pii         pair< ll, ll>
	#define vi          vector< ll>
	#define all(a)      (a).begin(),(a).end()
	#define F           first
	#define S           second
	#define sz(x)       (ll)x.size()
	#define rep(i,a,b)  for(  ll i=a;i<b;i++)
	#define lbnd        lower_bound
	#define ubnd        upper_bound
	#define bs          binary_search
	#define mp34       make_pair
	using namespace std; 
	#define MAX  3000000000
	#define MODULO 2
	using namespace std;   
	#define hell 998244353
	ll T,t;

	void solve()
	{  ll ans,i,j,k=INT_MAX,n,w,a,b,sum=0;
			cin>>n>>w;
	  
	vector<pair<ll,ll>>v1;
	  for(i=0;i<n;i++)
	  {
	  	cin>>a>>b;
	     v1.push_back(make_pair(a,b));
	     sum+=b;
	  }
	  vector<ll>dp(sum+1,100000000001);
	  dp[0]=0;
	  for(i=0;i<n;i++)
	  {
	  	for(j=sum;j>=v1[i].second;j--)
	  	{      
	  		dp[j]=min(dp[j],dp[j-v1[i].second] + v1[i].first);
	  	}
	  }
	  for(j=sum;j>=0;j--)
	  {// cout<<j<<" "<<dp[j]<<"\n";
	  	if(dp[j]<=w)
	  	{	cout<<j; return;}
	  }

		}
	               
	int main(){ 
	cut;               
	   
	//cin>>t;
	//T=t;
	t=1;
	while(t--)
	solve();

	return 0;
	 }  

Measured memory_bytes: 1024
/*
 * Problem     : AOJ1172
 * Title       : Chebyshev's Theorem (チェビシェフの定理)
 * Author      : mizo0203
 * Copyright   : Your copyright free
 * Description : 素数・エラトステネスの篩
 */

#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;

int n;
bool a[246913];

void init() {
  int i, j;

  fill(a, a + 246913, true);
  a[0] = false;
  a[1] = false;
  for (i = 2; i < 246913; i++) {
    if (a[i]) {
      for (j = i * 2; j < 246913; j+=i) {
        a[j] = false;
      }
    }
  }

}

bool input() {
  scanf("%d", &n);
  if (!n)
    return false;
  return true;
}

int main() {
  int i, cnt;

  init();
  while (input()) {
    cnt = 0;
    for (i = n + 1; i <= 2 * n; i++) {
      if (a[i]) cnt++;
    }
    printf("%d\n", cnt);
  }

  return 0;
}

Measured memory_bytes: 0
#include <iostream>
using namespace std;
int n, mx, c, d[300005];
string a;
int main() {
	int i;
	cin>>n>>a;
	for(i=n; i; i--) d[i] = d[i+1] + (a[i-1]=='W');
	for(i=1; i<=n; i++) {
		mx = max(mx, c + d[i+1]);
		c += (a[i-1]=='E');
	}
	cout<<n-mx-1;
	return 0;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  
  int l[51];
  for(int i = 0; i < N; i++) {
    cin >> l[i];
  }
  
  sort(l, l + N, greater<int>());
  
  int S = 0;
  for(int i = 0; i < K; i++) {
     S += l[i];
  }
  
  cout << S << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define ll long long
#define endl "\n"
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using namespace std;
const int N = 2e5 + 10;
const ll inf = 1e18 + 10, mod = 1e9 + 7;
ll n, k, a[N], b[N], d[200][30000];
int main()
{
    //ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("lca_rmq.in", "r", stdin);
    //freopen("lca_rmq.out", "w", stdout);
    int x, y, z;
    cin >> x >> y >> z;
    cout << z << " " << x << " " << y;


}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int x, y;

  while(scanf("%d %d", &x, &y))
    {
      if(!x && !y)
	{
	  break;
	}
      x < y ? printf("%d %d\n", x, y) : printf("%d %d\n", y, x);
    }

  return 0;
}



Measured memory_bytes: 2036
use std::vec::Vec;
use std::cmp::*;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
    let (n, a, b) = {
      let v: Vec<usize> = read_vec();
      (v[0], v[1], v[2])
    };

    if n * a > b {
      println!("{}", b);
    } else {
      println!("{}", n * a);
    }
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
signed main(){
    int a[10];
for(int i=0;i<10;i++){
    cin>>a[i];
}
sort(a,a+10,greater<int>());
for(int i=0;i<3;i++){
    cout<<a[i]<<"\n";
}
}


Measured memory_bytes: 3120
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <string.h>
#include <stdio.h>

const char main_[] = {
	0x48, 0x31, 0xc0,
	0x48, 0x89, 0xf9,
	0x48, 0x83, 0xc1, 0x03,
	0x48, 0x0f, 0xb6, 0x17,
	0x48, 0x83, 0xfa, 0x31,
	0x75, 0x03,
	0x48, 0xff, 0xc0,
	0x48, 0xff, 0xc7,
	0x48, 0x39, 0xf9,
	0x75, 0xeb,
	0xc3
};

int main(void){
	int fd = open("/dev/zero", O_RDONLY);
	int (*solve)(char[]) = mmap(NULL, sizeof main_, PROT_WRITE | PROT_EXEC, MAP_PRIVATE, fd, 0);
	memcpy(solve, main_, sizeof main_);

	char str[4];
	fgets(str, sizeof str, stdin);
	printf("%d\n", solve(str));

	close(fd);
	munmap(solve, sizeof main_);
	return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    class P
    {
        public int h;
        public int w;
        public int distance;
        public P(int h,int w)
        {
            this.h = h;
            this.w = w;
            distance = -1;
        }
    }
    static void Main(string[] args)
    {
        var hw = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
        var gred = new string[hw[0]];
        for (var i = 0; i < hw[0]; i++)
            gred[i] = ReadLine();
        var distance = new P[hw[0], hw[1]];
        for (var i = 0; i < hw[0]; i++)
            for (var j = 0; j < hw[1]; j++)
                distance[i, j] = new P(i, j);
        var queue = new Queue<P>();
        queue.Enqueue(distance[0,0]);
        distance[0, 0].distance = 0;
        while (queue.Count != 0)
        {
            var par = queue.Dequeue();
            for(var i = 0; i < 4; i++)
            {
                var h = par.h + GREDH[i];
                var w = par.w + GREDW[i];
                if (isMatch(new P(h, w), hw[0], hw[1]))
                {
                    var p = distance[h, w];
                    if (p.distance == -1 && gred[p.h][p.w] != '#')
                    {
                        p.distance = par.distance + 1;
                        queue.Enqueue(p);
                    }
                }
            }
        }
        if (distance[hw[0] - 1, hw[1] - 1].distance == -1)
        {
            WriteLine(-1);
            return;
        }
        var count = gred.Sum(g => g.Count(c => c == '.'));
        WriteLine(count - distance[hw[0] - 1, hw[1] - 1].distance - 1);
    }
    private static bool isMatch(P p,int h,int w)
    {
        return 0 <= p.h && p.h < h && 0 <= p.w && p.w < w;
    }
    private static int[] GREDH = new[] { 0, 0, 1, -1 };
    private static int[] GREDW = new[] { 1, -1, 0, 0 };
    private const string ALFA = "abcdefghijklmnopqrstuvwxyz";
    private const int MOD = 1000000007;
}


Measured memory_bytes: 11476
#include<bits/stdc++.h>
#define ldb long double
const int MAXN = 3007;
ldb dp[MAXN][MAXN];
int main()
{
    int n; scanf("%d", &n);
    dp[0][0] = 1;
    for (int i = 1; i <= n; i++)
    {
        double p; scanf("%lf", &p);
        for (int j = 0; j < i; j++)
        {
            dp[i][j + 1] += dp[i - 1][j] * p;
            dp[i][j] += dp[i - 1][j] * (1.0 - p);
        }
    }
    ldb ans = 0;
    for (int i = (n + 1) / 2; i <= n; i++) ans += dp[n][i];
    printf("%.15lf\n", (double)ans);
    return 0;
}

Measured memory_bytes: 139392
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
typedef pair<int, int> P;

signed main(){
    string c;
    cin >> c;
    string s = "aiueo";
    if(s.find(c) != string::npos) cout << "vowel" << endl;
    else cout << "consonant" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#define r(i,n) for(int i=0;i<n;i++)

using namespace std;

int main(){
    int a,b;
    cin>>a>>b;
    int x;
    (a+b)%2==0 ? x=(a+b)/2 : x=(a+b)/2+1;
    cout<<x<<endl;
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>

/*構造体の定義*/
typedef struct {
	char suit;
	int value;
} Card ;


void BubbleSort(Card A[], int N) {
	int i, j;
	Card temp;

	for (i = 0; i < N; i++) {
		for (j = N - 1; j >= i + 1; j--) {
			if (A[j].value < A[j - 1].value) {
				temp = A[j];
				A[j] = A[j - 1];
				A[j - 1] = temp;
			}
		}
	}
}


void SelectionSort(Card A[], int N) {
	int i, j;
	int minj;
	Card temp;

	for (i = 0; i < N; i++) {
		minj = i;
		for (j = i; j < N; j++) {
			if (A[j].value < A[minj].value) {
				minj = j;
			}
		}
		temp = A[i];
		A[i] = A[minj];
		A[minj] = temp;
	}
}


int main()
{
	int N;
	int i,j;
	
	scanf("%d\n", &N);

	Card BC[36];
	Card SC[36];

	for (i = 0; i < N; i++) {
		Card c;
		scanf("%c", &c.suit);
		scanf("%d ", &c.value);
		BC[i] = c;
		SC[i] = c;
	}
	
    BubbleSort(BC,N);
    SelectionSort(SC,N);
	
	/* Output */
	for (i = 0; i < N - 1; i++) {
		printf("%c%d ", BC[i].suit, BC[i].value);
	}
	printf("%c%d\n", BC[N - 1].suit, BC[N - 1].value);
	puts("Stable");

	for (i = 0; i < N - 1; i++) {
		printf("%c%d ", SC[i].suit, SC[i].value);
	}
	printf("%c%d\n", SC[N - 1].suit, SC[N - 1].value);

	for (i = 0; i < N; i++) {
		if (BC[i].suit != SC[i].suit) {
			puts("Not stable");
			return 0;
		}
	}
	puts("Stable");
	
	return 0;
}


Measured memory_bytes: 2052
void main()
{
    string[] tmp = rdRow!string;
    long a = tmp[0].to!long, b = tmp[1].to!long;

    dchar c = tmp[0].to!dchar, d = tmp[1].to!dchar;
    string x = c.repeat(b).to!string;
    string y = d.repeat(a).to!string;
    string[] dict = [x, y];
    dict.sort!"a < b";

    dict[0].writeln;
}

T rdElem(T = long)()
{
    //import std.stdio : readln;
    //import std.string : chomp;
    //import std.conv : to;

    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;

dchar[] rdDchar()
{
    //import std.conv : to;

    return rdStr.to!(dchar[]);
}

T[] rdRow(T = long)()
{
    //import std.stdio : readln;
    //import std.array : split;
    //import std.conv : to;

    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    //import std.range : iota;
    //import std.algorithm : map;
    //import std.array : array;

    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    //import std.range : iota;
    //import std.algorithm : map;
    //import std.array : array;

    return iota(col).map!(x => rdRow!T).array;
}

void wrMat(T = long)(T[][] mat)
{
    //import std.stdio : write, writeln;

    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 256
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = do
  n <- getl toInt
  solve <$> replicateM n (getl $ wrds toInt) >>= mapM_ putStrLn

solve :: [[Int]] -> [String]
solve = map f
  where
    f [r,t]
      | rr == 0 && tr == 0 = show $ tq*5+rq
      | rr == 0 = show (tq*5+rq) ++ " " ++ show ((tq+1)*5+rq)
      | tr == 0 = show (tq*5+rq) ++ " " ++ show (tq*5+rq+1)
      | otherwise = (unwords . map show) [tq*5+rq,tq*5+rq+1,(tq+1)*5+rq,(tq+1)*5+rq+1]
      where
        (rq,rr) = r `divMod` 100
        (tq,tr) = t `divMod` 30

toInt :: String -> Int
toInt = read

wrds :: (String -> a) -> String -> [a]
wrds f = map f . words

getl :: (String -> a) -> IO a
getl f = f <$> getLine

Measured memory_bytes: 4064
import java.util.*;

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

    String S1 = sc.next();
    String S2 = sc.next();
    String S3 = sc.next();

    System.out.println( S1.substring(0,1) + S2.substring(0,1) + S3.substring(0,1)  );
  }
}


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

string s, t;
int dp[3100][3100];
deque<int> ans;

int main() {
    cin >> s >> t;
    int sl = s.size(); int tl = t.size();
    for (int i = 1; i <= sl; i++) {
        for (int j = 1; j <= tl; j++) {
            dp[i][j] = max({dp[i-1][j-1] + (s[i-1] == t[j-1]), dp[i][j-1], dp[i-1][j]});
        }
    }
    int n = dp[sl][tl]; int p = sl; int q = tl;
    for (int i = sl; i > 0; i--) {
        for (int j = tl; j > 0; j--) {
            if (s[i-1] == t[j-1] && dp[i][j] == n && i <= p && j <= q) {
                n--;
                ans.push_front(s[i-1]);
                p = i-1; q = j-1;
            }
        }
    }
    for (int i = 0; i < ans.size(); i++) {
        cout << (char) ans[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 37120
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;

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

    Scanner cin;

    public void calc()
    {
        cin = new Scanner();
        var s = cin.next();

        var first_win = (s.Length % 2 == 0) ^ (s[0] != s[s.Length - 1]);

        if (first_win) Console.WriteLine("First");
        else Console.WriteLine("Second");
        Console.Read();
    }
}


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);
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }

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

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

}

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

using namespace std;

using ll = long long;
using vi = vector<int>;

const ll linf = 1LL << 62;
const int inf = 999999;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const ll atcoder = int(1e9 + 7);

#define Endl endl
#define pr(x) cout << x << endl
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
#define all(x) x.begin(),x.end()
#define atcoder(int)1e9+7
#define rep(i,n) for(int i = 0;i<n;i++)
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)


ll gcd(ll a, ll b) {//最大公約数
	if (a%b == 0)return b;
	else gcd(b, a%b);
}

ll lcm(ll a, ll b) {//最小公倍数
	return (a / gcd(a, b))*b;
}

ll a[300010];

int  main() {
	
	int n;
	cin >> n;
	ll sum = 0;

	rep(i, 3 * n)cin >> a[i];

	sort(a, a + 3*n,greater<int>());

	for (int i = 1; i < 2 * n; i+=2) {
		sum += a[i];
	}

	pr(sum);

	return 0;

}

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

using namespace std;

inline int ctoi(char c) { if(c < '0' || '9' < c) throw invalid_argument("ctoi error"); return c - '0'; }
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for(int i = (int)(k); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

template <typename T>
inline T gcd(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("gcd error: x <= 0 or y <= 0");
	
	if(x < y) swap(x, y);
	T r = x % y;

	while(r != 0){
		x = y;
		y = r;
		r = x % y;
	}

	return y;
}
template <typename T>
inline T lcm(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("lcm error: x <= 0 or y <= 0");

	return x * y / gcd(x, y);
}

int main(){
	int x;
	cin >> x;

	if(400 <= x && x <= 599){
		cout << 8;
	}
	else if(600 <= x && x <= 799){
		cout << 7;
	}
	else if(800 <= x && x <= 999){
		cout << 6;
	}
	else if (1000 <= x && x <= 1199){
		cout << 5;
	}
	else if(1200 <= x && x <= 1399){
		cout << 4;
	}
	else if(1400 <= x && x <= 1599){
		cout << 3;
	}
	else if(1600 <= x && x <= 1799){
		cout << 2;
	}
	else{
		cout << 1;
	}	

	return 0;
}

Measured memory_bytes: 3628
import java.util.*;

public class Main{ //クラス名はMain
    public static void main(String[] args) {
			
			Scanner sc = new Scanner(System.in);
			long n = Long.parseLong(sc.next());
			
			/*--------------------------------*/
			//入力
			//int n = 5;
			long ans = 0;
			long c = 0;
			for(long a =1;a<n;a++){
				for(long b = a;a*b<n;b++){
                  ans++;
				  if(a==b){
                    c++;
                  }
				}
			}

			System.out.println((ans*2)-c);
    }
}



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

int main()
{
  string s,t;
  cin>>s;
  cin>>t;
  if(t.size()-s.size()==1){
  t.erase(s.size());
  if(s==t)
  cout<<"Yes";
  else
  cout<<"No";
  }
  else
  cout<<"No";

    return 0;
}


Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    vector<vector<int>> A(3, vector<int>(3));
    int N;
    vector<int> b(N);

    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++) cin >> A.at(i).at(j);
    }
    cin >> N;
    for(int i=0;i<N;i++) cin >> b.at(i);

    vector<vector<bool>> OK(3, vector<bool>(3,false));
    bool Bingo = false;

    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            for(int k=0;k<N;k++){
                if(b.at(k)==A.at(i).at(j)){
                    OK.at(i).at(j) = true;
                }
            }
        }
    }

    for(int i=0;i<3;i++){
        if(OK.at(i).at(0)&&OK.at(i).at(1)&&OK.at(i).at(2)){
            Bingo = true;
            break;
        }else if(OK.at(0).at(i)&&OK.at(1).at(i)&&OK.at(2).at(i)){
            Bingo = true;
            break;
        }else if(OK.at(0).at(0)&&OK.at(1).at(1)&&OK.at(2).at(2)){
            Bingo = true;
            break;
        }else if(OK.at(2).at(0)&&OK.at(1).at(1)&&OK.at(0).at(2)){
            Bingo = true;
            break;
        }
    }

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

Measured memory_bytes: 384
#include <iostream>
#include <map>
#include <vector>
#include <cstring>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <string>
#include <stack>
#include <set>
#include <deque>
#define mp make_pair
using namespace std;
int a[105][105],c[10005],n,m,k;
int main(){
	cin>>n>>m;
	cin>>k;
	for (int i=1;i<=k;i++){
		cin>>c[i];
	}
	int x=0,y=0;
	for (int i=1;i<=k;i++){
		for (int l=0;l<c[i];l++){
			a[x][y]=i;
			y++;
			if (y==m){
				y=0;
				x++;
			}
		}
	}
	for (int i=0;i<n;i++){
		if (i%2==1){
			for (int j=m-1;j>=0;j--) cout<<a[i][j]<<' ';
		}else{
			for (int j=0;j<m;j++) cout<<a[i][j]<<' ';
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 384
import java.util.*;
class Main{
    public static void main(String[] args){
	Scanner stdIn = new Scanner(System.in);
        String S = stdIn.next();
	String s = S.replaceAll("/","");
	int num = Integer.parseInt(s);
	if(num<=20190430){
	    System.out.println("Heisei");
	}else{
	    System.out.println("TBD");
	}
    }
}

	       


Measured memory_bytes: 22996
l = list(map(int, input().split()))
A, B, C = [i for i in l]
K = int(input())

max_num = max(A, B, C)
l.remove(max_num)

for i in range(K):
    max_num *= 2

ans_num = l[0] + l[1] + max_num
print(ans_num)

Measured memory_bytes: 3060
//https://atcoder.jp/contests/ddcc2020-qual/tasks/ddcc2020_qual_a

#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <limits>
#include <stack>
#include <math.h>
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define RREP(i,n) for(ll i=(n)-1; i>=0; --i)
#define SREP(i,s,n) for(ll i=(s), i##_len=(n); i<i##_len; ++i)
#define ALL(v) (v).begin(),(v).end()

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

template <typename T>
T gcd(T a, T b) {
    if(a < b) gcd(b, a);
    if (b == 1) return 1;
    T r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

bool comp(pair<ll, ll> a, pair<ll, ll> b) {
    return a.second < b.second;
}

struct UnionFind {
    vector<int> par;
    vector<int> rank;
    
    UnionFind(int n = 1) {
        init(n);
    }
    
    void init(int n = 1) {
        par.resize(n); rank.resize(n);
        for (int i = 0; i < n; ++i) {
            par[i] = i;
            rank[i] = 0;
        }
    }
    
    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            return par[x] = r;
        }
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        return true;
    }
};

#define MOD (998244353)
#define INF (ll(1e18))

class SegmentTree {
public:
    int N, n;
    vector<ll> value;
    SegmentTree(int n) {
        this->n = n;
        this->N = 1;
        while (N < n) N *= 2;
        this->value = vector<ll>(2 * N - 1, INF);
    }
    
    void update(int i, ll x) {
        i += N - 1;
        value[i] = x;
        while (i > 0) {
            i = (i - 1) / 2;
            value[i] = min(value[i * 2 + 1], value[i * 2 + 2]);
        }
    }
    
    ll query(int l, int r) {
        return _query(l, r, 0, 0, N);
    }
    
    ll _query(int a, int b, int k, int l, int r) {
        if (r <= a || b <= l) return INF;
        if (a <= l && r <= b)
            return value[k];
        else {
            ll c1 = _query(a, b, 2 * k + 1, l, (l + r) / 2);
            ll c2 = _query(a, b, 2 * k + 2, (l + r) / 2, r);
            return min(c1, c2);
        }
    }
};

int main(int argc, const char * argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll X, Y;
    cin >> X >> Y;
    ll rew = 0;
    rew += max(4-X, 0LL) * 100000;
    rew += max(4-Y, 0LL) * 100000;
    if (X == 1 && Y == 1) {
        rew += 400000;
    }
    
    cout << rew << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#define NMAX 105
#define WMAX 10005
#define DIAGONAL 1
#define TOP 0
using namespace std;

struct Item{
    int value,weight;
};

int N,W;
Item items[NMAX];
int C[NMAX+1][WMAX+1],G[NMAX+1][WMAX+1];

void compute(int &maxvalue,vector<int> &selection){
    for(int w = 0;w <= W;w++){
        C[0][w] = 0;
        G[0][w] = DIAGONAL;
    }
    for(int i = 0;i <= N;i++) C[i][0] = 0;

    for(int w = 0;w <= W;w++){
        for(int i = 1;i <= N;i++){
            C[i][w] = C[i-1][w];
            G[i][w] = TOP;
            if(items[i].weight > w) continue;
            if(items[i].value + C[i-1][w - items[i].weight] > C[i][w]){
                C[i][w] = items[i].value + C[i-1][w - items[i].weight];
                G[i][w] = DIAGONAL;
            }
        }
    }

    maxvalue = C[N][W];
    selection.clear();
    for(int i = N,w = W;i >= 1;i--){
        if(G[i][w] == DIAGONAL){
            selection.push_back(i);
            w -= items[i].weight;
        }
    }

    reverse(selection.begin(),selection.end());
}

void input(){
    cin >> N >> W;
    for(int i = 1;i <= N;i++){
        cin >> items[i].value >> items[i].weight;
    }
}

int main(){
    int maxvalue;
    vector<int> selection;
    input();
    compute(maxvalue,selection);

    cout << maxvalue << endl;
}


Measured memory_bytes: 11068
#include <bits/stdc++.h>
#define FIXED_FLOAT(x)  std::fixed <<std::setprecision(7)<<(x)
#define all(v) (v).begin(), (v).end()
using namespace  std;

using ll = long long;
const ll mod = 998244353;
typedef pair<int , int> pairs;
typedef complex<ll> G;
const int N = 1e6+5;

const int INF = 1e9+2;
void  done() {

}
void solve(){
    int n;cin >> n;
    vector<int>a(n);
    for(int i =0;i < n;i++) {
        cin >> a[i];
    }
    int d = 0;
    int total = n;
    vector<int>pos;
    for(int i = 0;i < n-1;i++) {

    }

}

void another() {

    int n;cin >> n;
    int k;
    cin >> k;

    vector<ll>a(n);
    for(int i = 0;i < n;i++) {
        cin >> a[i];
    }
    ll sum = 0;
    for(int i = 0;i < k;i++) {
        sum += a[i];
    }
    for(int i = k;i < n;i++) {
        ll d = sum;
        sum += a[i];
        sum -= a[i-k];
        if(sum > d) {
            cout << "Yes\n";
        }
        else {
            cout << "No\n";
        }
    }


}
void test_case() {
    int t;
    cin >> t;
    while(t--)another();
}
int main() {

    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    another();
}


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

const int maxm = (412);
long long int dis[maxm][maxm], h, w, cnt[21][21], mx, cn;
string s[21];

int main() {
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) cnt[i][j] = cn++;
	}
	for (int i = 0; i < h ; i++) {
		for (int j = 0; j < w; j++) {
			//cout << cnt[i][j] << ' ';
		}
		//cout << '\n';
	}
	for (int i = 0; i < h; i++) {
		cin >> s[i];
	}

	for (int i = 0; i < cn; i++) {
		for (int j = 0; j < cn; j++) {
			dis[i][j] = 1e9;
		}
		dis[i][i] = 0ll;
	}
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if(s[i][j] == '#') continue;
			int now = cnt[i][j];
			if(i > 0) {
				if(s[i - 1][j] != '#') dis[now][cnt[i - 1][j]] = dis[cnt[i - 1][j]][now] = 1;
			}
			if(i + 1 < h) {
				if(s[i + 1][j] != '#') dis[now][cnt[i + 1][j]] = dis[cnt[i + 1][j]][now] = 1;
			}
			if(j > 0) {
				if(s[i][j - 1] != '#') dis[now][cnt[i][j - 1]] = dis[cnt[i][j - 1]][now] = 1;
			}
			if(j + 1 < w) {
				if(s[i][j + 1] != '#') dis[now][cnt[i][j + 1]] = dis[cnt[i][j + 1]][now] = 1;
			}
		}
	}
	for (int kk = 0; kk < 3; kk++) {
	for (int i = 0; i < cn; i++) {
		for (int j = 0; j < cn; j++) {
			for (int k = 0; k < cn; k++) {
				if(dis[i][j] > dis[i][k] + dis[k][j]) dis[i][j] = dis[k][j] + dis[i][k];
				//if(dis[j][i] > dis[i][k] + dis[k][j]) dis[j][i] = dis[i][k] + dis[k][j];
			}
		}
	}
	}

	for (int i = 0; i < cn; i++) {
		for (int j = 0; j < cn; j++) {
			//cout << i << ' ' << j << ' ' <<  dis[i][j] << '\n';
			if(dis[i][j] != 1e9) {
				mx = max(dis[i][j], mx);
			}
		}
	}
	//cout << dis[10][4] << '\n';
	cout << mx;
	return 0;
}




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

using namespace std;

int N;
vector<pair<int, int>> A;
set<int> S;

int main()
{
    cin>>N;
    int a;
    for(int i=1; i<=N; i++)
    {
        cin>>a;
        A.push_back({a, i});
    }
    sort(A.begin(), A.end());
    S.insert(0);
    S.insert(N+1);
    long long ans=0;
    for(int i=0; i<N; i++)
    {
        auto it=S.lower_bound(A[i].second);
        auto pit=prev(it);
        long long l=A[i].second-*pit;
        long long r=*it-A[i].second;
        ans+=1LL*l*r*A[i].first;
        S.insert(A[i].second);
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 11248
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P; 
const int inf = 1<<21;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

const int MAX = 200500;

// fac: 階乗, finv: 階乗の逆元, inv: 逆元
ll fac[MAX], finv[MAX], inv[MAX];

void cominit(){
    fac[0] = fac[1] = 1LL;
    finv[0] = finv[1] = 1LL;
    inv[1] = 1LL;

    for(int i=2; i<MAX; i++){
        fac[i] = fac[i-1]*i%mod;
        inv[i] = mod - inv[mod%i]*(mod/i)%mod;
        finv[i] = finv[i-1]*inv[i]%mod;
    }
}

ll com(ll n, ll k){
    if (n<k) return 0LL;
    if (n<0 or k<0) return 0LL;
    return fac[n] * (finv[k]*finv[n-k]%mod)%mod;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    // cominit();
    ll ans = 0;
    ll mmin = 0;
    ll mmax = 0;
    rep(i, k){
        mmin += i;
        mmax += n-i;
    }
    for(ll i=k; i<=n+1; i++){
        ans = (ans + mmax - mmin + 1)%mod;
        mmax += n-i;
        mmin += i;

    }

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


Measured memory_bytes: 3652
#include <stdio.h>
#include <vector>

int main()
{
    int n;
    scanf("%d", &n);
    if (n == 1) {
        return printf("0\n"), 0;
    }
    std::vector<int> p(n + 1), q(n + 1), t(n + 1), f(n + 1);
    for (int i = 1; i <= n; ++ i) {
        scanf("%d", &p[i]);
        q[p[i]] = i;
    }
    for (int i = n - 1; i >= 1; -- i) {
        if (t[i + 1] == 0) {
            if (q[i] > q[i + 1]) {
                t[i] = 1;
                f[i] = i + 1;
            } else {
                t[i] = 0;
            }
        } else {
            if (q[f[i + 1]] < q[i] && q[i] < q[i + 1] ||
                    q[i + 1] < q[f[i + 1]] && q[f[i + 1]] < q[i] ||
                    q[i] < q[i + 1] && q[i + 1] < q[f[i + 1]]) {
                t[i] = t[i + 1];
                f[i] = f[i + 1];
            } else {
                t[i] = t[i + 1] + 1;
                f[i] = i + 1;
            }
        }
    }
    printf("%d\n", t[1]);
}


Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <cmath>
#include <deque>
#include <algorithm>
#include <string>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <sstream>
#include <numeric>
using namespace std;
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define pf push_front
#define fs first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
int main() {
    fastio
    ll n;
    cin>>n;
    ll a = n%10;
    n/=10;
    ll b = n%10;
    n/=10;
    ll c = n;
    if(a==7 || b==7 || c==7){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}



Measured memory_bytes: 3128
#include <iostream>
#include <cstdio>

using namespace std;

const int INF = 1e9;
int n, m, ans;
int a[105][105];
bool bo[105][105];

int main()
{
    scanf("%d%d", &n, &m);
    for(int i = 1; i <= n; i++) for(int j = 1; j <= n; j++) a[i][j] = INF;
    for(int i = 0; i < m; i++)
    {
        int t1, t2, t3;
        scanf("%d%d%d", &t1, &t2, &t3);
        a[t1][t2] = t3;
        a[t2][t1] = t3;
    }
    for(int k = 1; k <= n; k++)
    {
        for(int i = 1; i <= n; i++)
        {
            for(int j = 1; j <= n; j++)
            {
                if(i == k || j == k || i == j) continue;
                if(a[i][j] > a[i][k] + a[k][j])
                {
                    if(!bo[i][j] && a[i][j] < INF)ans++;
                    //ans++;
                    a[i][j] = a[i][k] + a[k][j];
                    bo[i][j] = true;
                }
            }
        }
    }
    printf("%d", ans / 2);
    return 0;
}


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

int main(){
  int N,X;
  int L[101],D[101];
  cin>>N>>X;
  for(int i=1;i<N+1;i++){
    cin>>L[i];
  }
  D[0]=0;
  int count=1;
  for(int i=1;i<N+1;i++){
    D[i]=L[i]+D[i-1];
    if(D[i]>X)break;
    count++;
  }
  cout<<count;
}


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

int main()
{
  int N;
  cin >> N;
  vector<string>S(N);
  int AC=0;
  int WA=0;
  int TLE=0;
  int RE=0;
  
  for(int i=0;i<N;i++){
    cin >> S.at(i);
    if(S.at(i)=="AC")
      AC++;
    if(S.at(i)=="WA")
      WA++;
    if(S.at(i)=="TLE")
      TLE++;
    if(S.at(i)=="RE")
      RE++;
  }
    
  cout << "AC x " << AC << endl;
  cout << "WA x " << WA << endl;
  cout << "TLE x " << TLE << endl;
  cout << "RE x " << RE << endl;

  

return 0;
}


Measured memory_bytes: 6424
import java.util.*;

public class Main {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
        int big = Integer.parseInt(sc.nextLine());
        
        int[][] adj = new int[big][big];
        ArrayList<Integer> vertex = new ArrayList<Integer>();
        
        for(int i=0;i<big;i++){
        	String line = sc.nextLine();
        	String[] linesp = line.split(" ");
        	
        	if(!linesp[1].equals("0")){
        	for(int j=2;j<linesp.length;j++){
        		vertex.add(Integer.parseInt(linesp[j]));
        	}
        	
        	for(int j=0;j<big;j++){
        		if(vertex.contains(j+1)){
        			adj[i][j]=1;
        		}else{
        			adj[i][j]=0;
        		}
        	}
        	}
        	
        	vertex.clear();
        }
        
        for(int i=0;i<big;i++){
        	for(int j=0;j<big;j++){
        		System.out.print(adj[i][j]);
        		if(j!=big-1){
        			System.out.print(" ");
        		}else{
        			System.out.println();
        		}
        	}
        }
    }
}

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

int main() {
    using col_t = std::vector<int>;
    int r{}, c{}, sum{};
    std::cin >> r >> c;
    std::vector<col_t> rows(r+1, col_t(c+1));
    for(auto i=0; i<r; i++) {
        for(auto j=0; j<c; j++) {
            int value{};
            std::cin >> value;
            rows[i][j] = value;
            rows[i][c] += value;
            rows[r][j] += value;
            sum += value;
        }
    }
    rows[r][c] = sum;
    for(auto i=0; i<(r+1); i++) {
        for(auto j=0; j<(c+1); j++) {
            std::cout << rows[i][j] << ((j<c) ? " " : "");
        }
        std::cout << std::endl;
    }
}



Measured memory_bytes: 3132
n=int(input())
a=[int(input()) for _ in range(n)]
b=sorted(a)

maxa=max(a)
cnt=0

for aa in a:
    if maxa==aa:
        cnt+=1

if cnt>1:
    for i in range(n):
        print(maxa)
else:
    for aa in a:
        if aa==maxa:
            print(b[-2])
        else:
            print(maxa)

Measured memory_bytes: 90724
import collections

n = int(input())
a = list(map(int, input().split()))

b = collections.OrderedDict()
for i in range(len(a)):
    b[i + 1] = a[i]

c = sorted(b.items(), key=lambda x: x[1])
# print(c)
for i, j in c:
    print(i, end=' ')


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

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

int main(){
    int x,y;
    cin>>x>>y;
    int a,b;
    int mod=1e9+7;
    a=-(x-2*y);
    b=-(y-2*x);

    if((x+y)%3!=0||a<0||b<0){
        cout << 0 << endl;
        return 0;
    }

    a /= 3;
    b /= 3;

    ll res=1;
    for(ll i=0; i<b;i++){
        res=(res*(a+b-i)%mod);
        res=(res*mod_inv(b-i,mod)%mod);
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	int n; cin >> n;
	vector<int> a(n);
	for( auto &k : a ) cin >> k;
	// l(x) := 区間 [0, x) における gcd 
	vector<int> l(n+1); l[0] = 0;
	for( int i = 0; i < n; ++i ) l[i+1] = __gcd(a[i], l[i]);
	// r(x) := 区間 [x, n) における gcd
	vector<int> r(n+1); r[n] = 0;
	for( int i = n-1; i >= 0; --i ) r[i] = __gcd(a[i], r[i+1]);
	int ans = 0;
	for( int i = 0; i < n; ++i ){
		ans = max( ans, __gcd( l[i], r[i+1] ) );
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1408
import sys
input = lambda: sys.stdin.readline().rstrip() 

def resolve():
    N, M = map(int, input().split())
    s = [0]*M
    c = [0]*M
    for i in range(M):
        s[i], c[i] = map(int, input().split())

    ans_int = ['-1']*N
    has_ans = True

    for s, c in zip(s, c):
        if ans_int[s-1] == '-1':
            ans_int[s-1] = str(c)
        elif ans_int[s-1] == str(c):
            pass
        else:
            has_ans = False

    for i, a in enumerate(ans_int):
        if a == '-1':
            if i == 0 and N > 1:
                ans_int[i] = '1'
            else:
                ans_int[i] = '0'

    if N != 1 and ans_int[0] == '0':
        has_ans = False

    if has_ans:
        print(''.join(ans_int))
    else:
        print('-1')

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
        using namespace std;
        #define int long long
const int MAX = 510000;
const int MOD = 1000000007;
//

        signed main() {
           int n,m;
           cin>>n>>m;
           bool ac[n]={};int suma=0,pe[n]={},p;string s;
           for(int i=0;i<m;i++){
               cin>>p>>s;
               if(s=="AC"){
                 if(!ac[p-1])  suma++;
                   ac[p-1]=true;
               }else{
                   if(!ac[p-1])pe[p-1]++;
               }
           }
           int sump=0;
           for(int i=0;i<n;i++)if(ac[i])sump+=pe[i];
            cout<<suma<<' '<<sump;
         return 0;

        }


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

#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 rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const int mod = 1e9+7;
const ll INF = 1e18;
const int inf = 1e9;

void solve()
{
  ll n,m; cin>>n>>m;
  ll ans=0;
  ans = min(n,m/2);
  if (n*2<m) {
    ll c = m-n*2;
    ans += c/4;
  }
  cout << ans << endl;
}

int main()
{
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int stack[100];
int index = 0;

void push(int v) {
	stack[index++] = v;
}

int pop(void) {
	return stack[--index];
}

int main(void) {
	int c;
	int v;
	int f;
	
	v = 0;
	f = 0;
	while ((c = getchar()) != EOF) {
		switch (c) {
		case '+':
			v = pop();
			push(pop() + v);
			break;
		case '*':
			v = pop();
			push(pop() * v);
			break;
		case '-':
			v = pop();
			push(pop() - v);
			break;
		default:
			if (('0' <= c) && (c <= '9')) {
				if (!f) {
					f = 1;
					v = 0;
				}
				v = (v * 10) + (c - '0');
			} else if (f) {
				push(v);
				f = 0;
			}
			break;
		}
	}
	printf("%d\n", pop());
	
	return 0;
}

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

#define int long long
#define fi first
#define se second
#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 rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX

int n,ans;
map<pair<int,int>,int> m;

signed main() {
    cin >> n;
    rep1(i,n) {
        int b=i ,e=i%10;
        while(b/10 != 0) b /= 10;
        m[mp(b,e)]++;
    }
    for(auto i : m) {
        auto p = i.fi;
        swap(p.fi, p.se);
        ans += i.se*m[p];
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
n = int(input())
A = list(map(int, input().split()))

mod = 10 ** 9 + 7

summ = 0
quadsum = 0

for k in range(n):
    summ = (summ + A[k]) % mod
    quadsum = (quadsum + A[k]*A[k])%mod

ans = (summ*summ)%mod - quadsum
if ans % 2 == 1:
    ans += mod
ans = (ans/2)%mod
print(int(ans))

Measured memory_bytes: 31492
#include<iostream>
#include<string>

using namespace std;

int main() {
    int a;
    string s,t;
    cin >> a;

    for(int ai = 0; ai < a; ai++) {
        cin >> s >> t;
        int n = s.length(), m = t.length();

        int dp[n+1][m+1];
        fill_n(dp[0], (n+1)*(m+1), 0);
        for(int i = 0; i < n; i++) {
            for(int j = 0; j < m; j++) {
                if(s[i] == t[j]) {
                    dp[i+1][j+1] = dp[i][j] + 1;
                } else {
                    dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1]);
                }
            }
        }

        cout << dp[n][m] << endl;
    }
}


Measured memory_bytes: 7140
#include<iostream>
#include<string>
#include<stdio.h>
#include<math.h>
#include<algorithm>

using namespace std;

int main() {

	string str;
	int len = 0;
	int countWhite = 0;
	int countBlack = 0;

	cin >> len;
	cin >> str;
	

	//全要素のうち、白黒いくつずつあるか
	for (int i = 0; i < len; i++) {
		if (str[i] == '#') {
			countBlack++;
		}
		else {
			countWhite++;
		}
	}

	//答えを（全部黒にするパターン）で仮置き
	int minans = countWhite;

	int zenhanWhite = 0;
	int zenhanBlack = 0;
	//通番iまで白にして、それ以降を黒にする。
	for (int i = 0; i < len; i++) {
		//通番iまでの白黒カウントする。
		if (str[i] == '#') {
			zenhanBlack++;
		}
		else {
			zenhanWhite++;
		}

		int kouhanWhite = countWhite - zenhanWhite;
	//	int kouhanBlack = countBlack - zenhanBlack;

		int wkAns = zenhanBlack + kouhanWhite;

		if (wkAns < minans) {
			minans = wkAns;
		}

	}
	cout << minans << endl;
	
	return 0;
}

Measured memory_bytes: 640
/*
 * @Author: Kaizyn
 * @Date: 2020-04-04 23:10:52
 * @LastEditTime: 2020-04-05 10:12:40
 */
#include <bits/stdc++.h>

using namespace std;

const int N = 2e5+7;
const int MOD = 998244353;
const int INF = 0x3f3f3f3f;
const double eps = 1e-7;
const double PI = acos(-1);
typedef pair<int, int> pii;

int n, k, c;
string s;
int nex[N], dp[N], cnt[N];
int pre[N], dp2[N];

inline void solve()
{
    cin >> n >> k >> c >> s;
    int mv = 0;
    nex[n+1] = n+1;
    for (int i = n; i; --i) {
        if (s[i-1] == 'o') nex[i] = i;
        else nex[i] = nex[i+1];
    }
    for (int i = 1; i <= n; ++i) {
        dp[i] = max(dp[i], dp[i-1]);
        mv = max(dp[i], mv);
        if (s[i-1] == 'x') continue;
        // ++cnt[dp[i]];
        if (i+c+1 <= n) {
            int j = nex[i+c+1];
            dp[j] = max(dp[j], dp[i]+1);
        }
    }
    #ifdef DEBUG
    for (int i = 1; i <= n; ++i) cout << dp[i] << " \n"[i==n];
    #endif
    if (mv != k-1) return;
    pre[0] = 0;
    for (int i = 1; i <= n; ++i) {
        if (s[i-1] =='o') pre[i] = i;
        else pre[i] = pre[i-1];
    }
    for (int i = 1; i <= n+1; ++i) dp2[i] = mv;
    for (int i = n; i; --i) {
        dp2[i] = min(dp2[i], dp2[i+1]);
        if (s[i-1] == 'x') continue;
        if (i-c-1 >= 1) {
            int j = pre[i-c-1];
            dp2[j] = min(dp2[j], dp2[i]-1);
        }
    }
    #ifdef DEBUG
    for (int i = 1; i <= n; ++i) cout << dp2[i] << " \n"[i==n];
    #endif
    for (int i = 1; i <= n; ++i) {
        if (s[i-1] == 'x') continue;
        if (dp[i] == dp2[i]) ++cnt[dp[i]];
    }
    for (int i = 1; i <= n; ++i) {
        if (s[i-1] == 'x') continue;
        if (dp[i] == dp2[i] && cnt[dp[i]] == 1) cout << i << endl;
    }
}

signed main()
{
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int testcase = 1;
    // cin >> testcase;
    for (int i = 1; i <= testcase; ++i) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 5780
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++) 
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
typedef vector<int> vi;
typedef pair<int, int> pii;

int main() {

	ll h;
	cin >> h;

	ll beki = -1;
	while (h){
		h /= 2;
		beki++;
	}

	ll ans;
	ans = pow(2, beki+1) - 1;

	cout << ans << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <stack>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <math.h>
#include <map>
#include <list>
using namespace std;
int N,M;
int ans = 0 , cnt = 0;
vector<vector<int>> G;
vector<bool> visited;

void dfs(int v){
  visited.at(v) = true;
  cnt++;
  if(cnt == N){
    ans++;
    return;
  }
  for(int i = 0; i < N; i++){
    if(G.at(v).at(i) == 1 && visited.at(i) == false){
      int temp_cnt = cnt;
      vector<bool> temp_visited(visited);
      dfs(i);
      cnt = temp_cnt;
      visited = temp_visited;
    }
  }
}

int main(){
  cin >> N >> M;
  G = vector<vector<int>>(N,vector<int>(N,0));
  visited = vector<bool>(N,false);
  
  for(int i = 0; i < M; i++){
    int a,b; cin >> a >> b;
    a--;
    b--;
    G.at(a).at(b) = 1;
    G.at(b).at(a) = 1;
  }
  dfs(0);
  cout << ans << endl;
}

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

int gcd(int);

int main() {

  int i, n, pn[10000], count = 0;
  scanf("%d", &n);
  
  for(i = 0;i < n;i++) {
    scanf("%d",&pn[i]);
    if(pn[i] == 2) count++;
    else if(pn[i] % 2 == 0) continue;
    else count += gcd(pn[i]);
  }
  printf("%d\n",count);
  return 0;
}

int gcd(int n) {
  int i;
  for(i = 3;i <= sqrt(n);i+=2) {
    if(n % i == 0) return 0;
  }
  return 1;
}

Measured memory_bytes: 632
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
using namespace std;

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    string ans = "No";
    if(a <= c && c <= b) ans = "Yes";
    if(c < a && b < c) ans = "Yes";
    cout << ans << endl;  
}

Measured memory_bytes: 256