akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
vector<int> v;
int main() {
  long long a, b;
  cin >> a >> b;
  if (a <= 0 && 0 <= b) {
    cout << "Zero" << endl;
  } else if (0 < a){
    cout << "Positive" << endl;
  } else if (-( a - b  ) % 2 == 1) {
    cout << "Positive" << endl;
  } else {
    cout << "Negative" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<long double, long double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int MOD = 1000000007;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

int mood(int a, int b){
    if (a % b == 0) return b;
    else return a % b;
}

int main() {
    string s; cin >> s;
    if (s == "ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;
}

Measured memory_bytes: 3624
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 1e18
#define MOD 100000007
#define SIZE 10005
#define PI 	3.14159265358979323846


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int sum = 0;
    int a[5];
    int m = 0;
    REP(i,5){
        cin >> a[i];
        sum += ((a[i] + (10 - 1)) / 10)*10;
        if(a[i]%10)m = max(m,abs(10-a[i]%10));
    }
    cout << sum-m << endl;
}

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

int main() {
  string s;
  int ans = 0;
  cin >> s;
  rep(i, s.size()/2){
    if(s.at(i) != s.at(s.size()-i-1)){
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<n;i++)
#define For(i,n1,n2) for(int i=n1;i<n2;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define RREP(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
typedef long long ll;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

int main(){
    int a,b,c,x;
    cin >> a >> b >> c >> x;
    int res = 0;
    for(int i=0;i*500<=x;++i){
        for(int j=0;i*500+j*100<=x;++j){
            int s = x-i*500-j*100;
            if(s%50==0){
                int k = s/50;
                if(i<=a&&j<=b&&k<=c){
                    res++;
                }
            }
        }
    }
    put(res);
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int a,b,c,d,e,f;
    while(~scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f)){
        double y=(double)(c*d-a*f)/(double)(b*d-a*e);
        if(a!=0)
        printf("%.3f %.3f\n",(c-b*y)/a,y);
        else
        printf("%.3f %.3f\n",(f-e*y)/d,y);
    }
}

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

using namespace std;


int main() {
    int cand[] = {111, 222, 333, 444, 555, 666, 777, 888, 999};
    int N; cin >> N;

    for(int i=0;i<=9;i++) {
        if(N <= cand[i]) {
            cout << cand[i] << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
fn get_input() -> String {
    let mut word = String::new();
    std::io::stdin().read_line(&mut word).unwrap();
    word.trim().to_owned()
}

fn main() {
    let n: usize = get_input().parse().unwrap();
    let mut a: Vec<i32> = Vec::with_capacity(n);

	let line = get_input();
    let mut split = line.split_whitespace();
    for _i in 0..n {
        let v:i32 = split.next().unwrap().parse().unwrap();
        a.push(v);
    }

    let mut alice = 0;
    let mut bob = 0;

    a.sort();
    a.reverse();
    for i in 0..a.len() {
        if i % 2 == 0 {
            alice = alice + a[i];
        } else {
            bob = bob + a[i];
        }
    }

    let diff_point = alice - bob;
    println!("{}", diff_point);
}

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

int main() {
    int N; cin >> N;
    int L; cin >> L;

    int total = 0;
    rep(i, N){
        total += L+i;
    }
    if(L >= 0){
        total -= L;
    } else if(L+N-1 < 0){
        total -= L+N-1;
    }

    cout << total << endl;

    return 0;
}

Measured memory_bytes: 3632
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

a, b, c = map(int, input().split())

ans = (c + 0.5) // a * b
print(int(ans))

Measured memory_bytes: 7752
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ALDS1_3_B
{
    public class Program

    {
        struct Task
        {
            public string name { get; set; }
            public int time { get; set; }

            public Task(string[] x)
            {
                this.name = x[0];
                this.time = int.Parse(x[1]);
            }
        }

        public static void Main(string[] args)
        {
            int[] line = ReadIntAr();
            int n = line[0];
            int q = line[1];
            Queue<Task> tasks = new Queue<Task>();
            for (int i = 0 ; i < n ; i++) tasks.Enqueue(new Task(ReadStAr()));

            int elapsedTime = 0;
            Task tmp;
            while (tasks.Count > 0)
            {
                tmp = tasks.Dequeue();
                if (tmp.time <= q)
                {
                    elapsedTime += tmp.time;
                    Console.WriteLine("{0} {1}", tmp.name,elapsedTime);
                }
                else
                {
                    elapsedTime += q;
                    tmp.time -= q;
                    tasks.Enqueue(tmp);
                }
            }
        }

        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }

    }

}



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

int main() {
   int n, q;
   cin >> n;
   vector<int> s(n);
   rep(i,n) cin >> s[i];
   int ct = 0;
   cin >> q;
   rep(i,q) {
      int left = 0;
      int right = n-1;
      int x;
      cin >> x;
      if (*lower_bound(s.begin(),s.end(),x) == x) ct++;
   }
   cout << ct << endl;
}



Measured memory_bytes: 3132
#include <cstdio>
#include <cstring>
#define min(a,b) ((a)>(b)?(b):(a))
int k[10000];
short dp[2][5001][2];
int main() {
	int N;
	scanf("%d",&N);
	for(int i=0;i<(N-1);i++) {
		scanf("%d",&k[i]);
	}
	memset(dp,0x7f,sizeof(dp));
	dp[0][0][0]=0;
	for(int i=0;i<N;i++) {
		int m=min(i,N/2);
		for(int j=0;j<=m;j++) {
			dp[(i+1)&1][j+1][0]=min(dp[i&1][j][0],dp[i&1][j][1]+k[i]);
			dp[(i+1)&1][j][1]=min(dp[i&1][j][1],dp[i&1][j][0]+k[i]);
		}
		dp[i&1][0][0]=0x7f7f;
	}
	printf("%d\n",dp[0][N/2][0]);
}

Measured memory_bytes: 1112
#include <stdio.h>

int main()
{
  long long int  n, m = 1,i;


  scanf("%lld", &n);
  if(n<=20)

  for (i = 1; i <= n; i++){
    m = m* i;
  }
  printf("%lld\n",m);

  return 0;
}

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

int main(){ 
  int n;
  ll v;
  cin >> n >> v;

  vector<ll> a(n), b(n), c(n), d(n);

  rep(i,n) cin >> a[i];
  rep(i,n) cin >> b[i];
  rep(i,n) cin >> c[i];
  rep(i,n) cin >> d[i];

  vector<ll> ab, cd;

  rep(i,n) rep(j,n) ab.emplace_back(a[i] + b[j]), cd.emplace_back(c[i] + d[j]);

  sort(ab.begin(), ab.end());
  sort(cd.begin(), cd.end());
  ll res = 0;
  for (auto d : ab) {
    ll x = v - d;
    if (x <= 0) break;
    auto cnt = upper_bound(cd.begin(), cd.end(), x) - lower_bound(cd.begin(), cd.end(), x);
    res += cnt;
  }
  cout << res << endl;
  return 0;
} 


Measured memory_bytes: 18844
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>
#include<bits/stdc++.h>
using namespace std;
struct activity
{
    int a,b,c;
};
int solve(vector<activity> ar,int n )
{
    for(int i=2;i<=n;i++)
    {
        ar[i].a = ar[i].a + max(ar[i-1].b,ar[i-1].c);
        ar[i].b =ar[i].b + max(ar[i-1].c,ar[i-1].a);
        ar[i].c = ar[i].c+max(ar[i-1].a,ar[i-1].b);
    }
    
    int l=ar[n].a;
    int m=ar[n].b;
    int p=ar[n].c;
    if(l>m&&l>p)
    {
        return l;
    }
    else
    {
        if(m>p)
        {
            return m;
        }
        else
        {
            return p;
        }
    }
}
int main()
{
    int n;
    cin>>n;
    vector<activity> arr(n+1);
    for(int i=1;i<=n;i++)
    {
        cin>>arr[i].a;
        cin>>arr[i].b;
        cin>>arr[i].c;
    }
    cout<<solve(arr,n);

    return 0;
}


Measured memory_bytes: 2560
import java.util.Scanner;
import java.util.Arrays;

public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt(),ans=0;
        int[] S=new int[n];
        for(int i=0;i<n;i++)S[i]=sc.nextInt();
        int q=sc.nextInt();
        int[] T=new int[q];
        for(int i=0;i<q;i++)T[i]=sc.nextInt();
        Arrays.sort(T);
        for(int i=0;i<q;i++){
            for(int j=i;j<n;j++){
                if(T[i]==S[j]){
                    ans++;
                    break;
                }else if(T[i]<S[j]){
                    break;
                }
            }
        }
        System.out.println(ans);
        sc.close();
    }
}


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

int main() {
  int64_t A, B, C, D;
  cin >> A >> B >> C >> D;
  
  int64_t ans = 0;
  
//A以上B以下でCで割れる整数の数
  
  int64_t ans_C = 0;
  ans_C = (B / C) - ((A - 1) / C);
  
//A以上B以下でDで割れる整数の数
  
  int64_t ans_D = 0;
  ans_D = (B / D) - ((A - 1) / D);
  
  int64_t a, b, r, tmp;
  a = C;
  b = D;
  if(a<b){ 
  tmp = a; a = b;
  b = tmp;
  }
  r = a % b; 
  while(r!=0){
  a = b;
  b = r;
  r = a % b;
  }
  int64_t gcd = b;
  
  int64_t ans_CD = 0;
  if(gcd != 0){
  ans_CD = (B / (C * D / gcd)) - ((A - 1) / (C * D/gcd));
  }
  else{
  ans_CD = (B / (C * D)) - ((A - 1) / (C * D));
  }

  ans = B - A + 1 - ans_C - ans_D + ans_CD;
  
  cout << ans << endl;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <queue>
using namespace std;
typedef long long int ll;
typedef long double ld;
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; }
const long long INF = 1LL << 60;
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
bool pairCompareSecond(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}
#define MAX_N 100100
#define MOD 1000000007
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
// 四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

void  base_num(ll data,ll base){
    if(data==0) return;
    ll next=abs(data)%abs(base);
    if(data<0) next=(abs(base)-next)%abs(base);
    base_num((data-next)/base,base);
    cout << next;
}



int main(){
    ll n,m=0;
    cin >> n;
    ll a[n];
    ll c[110000];
    fill(c,c+101000,0);
    for (ll i=0;i<n;i++){
        cin >> a[i];
        c[a[i]]=c[a[i]]+1;
        c[a[i]+1]=c[a[i]+1]+1;
        c[a[i]+2]=c[a[i]+2]+1;
        m=max(max(m,c[a[i]]),max(c[a[i]+2],c[a[i]+1]));
    }
    cout << m << endl;
    return 0;
}



Measured memory_bytes: 1792
import java.util.Scanner;
public class Main{
 
   
  public static void main(String[] args)
  {
     
  
    Scanner s=new Scanner(System.in);
    int n=s.nextInt();
    int k=s.nextInt();
    int arr[]=new int[n];
    for(int i=0;i<n;i++)
    	arr[i]=s.nextInt();
	  
    int dp[]=new int[n];
    
    	
    for(int i=0;i<n;i++)
 	   dp[i]=Integer.MAX_VALUE;
     dp[0]=0;
     dp[1]=Math.abs(arr[0]-arr[1]);
    
    
    
     for(int i=1;i<n;i++)
     {
     	for(int j=1;i-j>=0&&j<=k;j++)
 	   dp[i]=Math.min(dp[i],dp[i-j]+Math.abs(arr[i]-arr[i-j]));
 	   
     }
     
    System.out.print(dp[n-1]);
    s.close();
  }
}

Measured memory_bytes: 52584
#include<iostream>
using namespace std;
int main(){
  int a,b; cin >> a >> b;
  string s; cin >> s;
  for(int i=0;i<a;i++){
    if(!(s[i]>='0' && s[i]<='9')){
      cout << "No" << endl;
      return 0;
    }
  }
  if(s[a]!='-'){
    cout << "No" << endl;
    return 0;
  }
  for(int i=a+1;i<a+b+1;i++){
    if(!(s[i]>='0' && s[i]<='9')){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

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

int main()
{
  ll n, a, b;
  cin >> n >> a >> b;
  ll res = n / (a+b)*a;
  ll r = n % (a+b);
  res += min(r, a);
  cout << res << endl;
  return 0;
}


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

#include <iostream>
#include <fstream>

#include "bits/stdc++.h"

#define REP(i,x,y) for(int i=(x);i<(y);i++)
#define RREP(i,x,y) for(int i=(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
//#define int long long

using namespace std;

// conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

typedef long long ll;

const ll MOD = 1e9 + 7;

class EDoubleFactorial {
public:
	void solve(std::istream& in, std::ostream& out) {
	    ll N;
	    in >> N;
	    if (N % 2 == 1) {
	        out << 0 << "\n";
	        return;
	    }
	    ll fiveMultiplies = 10;
	    ll answer = 0;
	    while (fiveMultiplies <= N) {
	        answer += N / fiveMultiplies;
	        fiveMultiplies *= 5;
	    }
	    out << answer << "\n";
	}
};


signed main() {
	EDoubleFactorial solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
const int MOD = 1e9+7,MAX = 1e5;

int main()
{
	while(1)
	{
		int a,b;
		cin >> a >> b;
		if(a==0&&b==0)break;

		rep(i,a)
		{
			rep(j,b)
			{
				if(i==0||i==a-1||j==0||j==b-1)
				{
					cout<<'#';
				}
				else
				{
					cout<<'.';
				}
				
			}
			cout<<endl;
		}
		cout<<endl;
	}
	return 0;
}


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

int main()
{
  int N, K;
  cin >> N >> K;
  
  vector<int> vec(N);
  vector<double> vecexp(N);

  double exp, maxExp;
  int offset = 0;
  
  for (int i = 0; i < N; i++) 
  {
    cin >> vec.at(i);
    int pi = vec.at(i);
    double dpi = (double)pi;
    vecexp.at(i) = (1 + dpi) / 2;
    exp += vecexp.at(i);
    if (i >= K)
    {
      exp -= vecexp.at(offset);
      offset++;
    }
    if (exp > maxExp)
    {
      maxExp = exp;
    }
  }
 
  cout << fixed << setprecision(12) << maxExp << endl;
      
  return 0;
}


Measured memory_bytes: 2560
n, t = map(int, input().split())
ct = []
ctls = [list(map(int, input().split())) for _ in range(n)]
for i in range(n):
	if ctls[i][1] > t:
		ans = "TLE"
	else:
		ct.append(ctls[i][0])
if ct == []:
	print(ans)
else:
	print(min(ct))

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

int main() {
  int n,T;
  cin>>n>>T;
  int t[n];
  for(int i=0;i<n;i++){
    cin>>t[i];
  }
  int sum=0;
  if(n>2){
  for(int i=0;i<n;i++){
    if((t[i]-t[i-1])>T)
    sum+=T;
    else{sum+=t[i]-t[i-1];}
  }
  }
  
  else if(n==2){if((t[1]-t[0])>T)sum+=T;
       else{sum+=t[1]-t[0];
           }
           }
  else if(n==1){
    sum=0;
  }
                
       sum+=T;
  cout<<sum<<endl;
      
}

Measured memory_bytes: 1024
import sys
from collections import defaultdict
from collections import deque
import numpy as np
import heapq
from heapq import heappush, heappop


#read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

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

acs = 0
wro = 0

PROB = [0] * N
WRON = [0] * N

for _ in range(M):
    p, s = input().split()
    p = int(p) - 1

    if PROB[p] == 1:
        continue

    if s == 'AC':
        PROB[p] = 1
        acs += 1
    elif s == 'WA':
        WRON[p] += 1

for i in range(N):
    if PROB[i] == 1:
        wro += WRON[i]

print(str(acs)+" "+str(wro))


Measured memory_bytes: 21416
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define forE(i,x) for(int i=head[x];i!=-1;i=ne[i])
using namespace std;
typedef long long i64;
typedef unsigned long long u64;
typedef unsigned u32;
typedef pair<int,int> pin;
#define mk(a,b) make_pair(a,b)
#define lowbit(x) ((x)&(-(x)))
#define sqr(a) ((a)*(a))
#define clr(a) (memset((a),0,sizeof(a)))
#define ls ((x)<<1)
#define rs (((x)<<1)|1)
#define mid (((l)+(r))>>1)
#define pb push_back
#define w1 first
#define w2 second
inline void read(int &x){
	x=0;int f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	x*=f;
}
inline void judge(){
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
}
/*******************************head*******************************/
const int maxn=20;
const int mod=1e9+7;
int f[2][1<<maxn];
int place[1<<maxn][maxn+6];
int n,m,c,col[maxn+5][maxn+5];
inline void add(int &x,int y){
	x=((x+y)>=mod?(x+y-mod):(x+y));
}
int main(){
	read(n);read(m);read(c);
	rep(i,1,m)rep(j,1,n)col[i][j]=3;
	rep(i,1,c){
		int x,y,z;read(x);read(y);read(z);
		col[x][y]=z+1;
	}
	f[0][0]=1;
	rep(i,0,(1<<(n-1))-1){
		int lst=n-1;
		per(j,n-2,0){
			if((1<<j)&i)lst=j;
			place[i][j]=lst;
		}
	}int st=1,ed=0;
	rep(i,1,m)rep(j,1,n-1){
		swap(st,ed);
		memset(f[ed],0,sizeof(f[ed]));
		rep(s,0,(1<<(n-1))-1)if(f[st][s]){
			rep(k,0,1){
				if(!((col[i][j])&(1<<k)))continue;
				int news=s;
				if((s&(1<<(j-1)))&&(k==0))continue;
				if((place[news][j-1]!=n-1)&&(k==1)){
					news&=((1<<(n-1))-1)^(1<<((place[news][j-1])));
				}
				news&=((1<<(n-1))-1)^(1<<((j-1)));
				news|=(k<<(j-1));
				add(f[ed][news],f[st][s]);
			}	
		}
	}int ans=0;
	rep(s,0,(1<<(n-1))-1)add(ans,f[ed][s]);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 63872
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int r,d,x;

		Scanner sc = new Scanner(System.in);
		r = sc.nextInt();
		d = sc.nextInt();
		x = sc.nextInt();
		for(int i=0;i<10;i++) {
			System.out.println(r*x-d);
			x = r*x-d;
		}
		
	}
}

Measured memory_bytes: 22868
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let n = read_as_vec::<usize>()[0];
    let k = read_as_vec::<usize>()[0];
    let mut x = 1;

    for i in 0..n{
        if x < k{
            x *= 2;
        }else{
            x += k;
        }
    }

    println!("{}", x);
}


Measured memory_bytes: 4352
list1 = []
list2 = []
tmp = 0
max = 0
n2 = input()
n = int(n2)
for i in range(n):
   list1.append(input())
m2 = input()
m = int(m2)
for i in range(m):
   list2.append(input())
for person in list1:
   tmp = 0
   for people in list1:
       if(people == person):
          tmp += 1
   for people in list2:
       if(people == person):
          tmp -= 1
   if(tmp > max):
       max = tmp
print(max)

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

struct my_str{
  bool flip = false;
  deque<char> d;
  
  void add_front(char ch) {
    if (!flip) d.push_front(ch);
    else d.push_back(ch);
  }
  
  void add_back(char ch) {
    if (!flip) d.push_back(ch);
    else d.push_front(ch);
  }
  
  void reverse() {
    flip = !flip;
  }
};

int main() {
  my_str m;
  string s;
  cin >> s;
  for (char ch : s) m.add_back(ch);
  int q;
  cin >> q;
  while (q--) {
    int t;
    cin >> t;
    if (t == 1) {
      m.reverse();
    } else {
      int f; char c;
      cin >> f >> c;
      if (f == 1) m.add_front(c);
      else m.add_back(c);
    }
  }
  if (m.flip) reverse(m.d.begin(), m.d.end());
  m.flip = false;
  for (char ch : m.d) cout << ch;
  return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

int main() {
    int D;
    ll mod = 1e9+7;
    string K;
    cin >> K >> D;
    
    // dp[i][j][k]: 先頭からi桁までの数の総和をDで割った余りがkであるもの　かつ　条件が j=1 => tight
    vector<vector<vector<ll>>> dp(K.length(), vector<vector<ll>>(2, vector<ll>(D)));
    for(int k=0; k<int(K[0]-'0'); k++) dp[0][0][k%D] += 1;
    dp[0][1][int(K[0]-'0')%D] = 1;

    for(int i=1; i<K.length(); i++) {
        for(int k=0; k<D; k++) {
            for(int s=0; s<=9; s++) {
                if(s == int(K[i] - '0')) {
                    (dp[i][1][(k+s)%D] += dp[i-1][1][k]) %= mod;
                }
                else if(s<int(K[i]-'0')) {
                    (dp[i][0][(k+s)%D] += dp[i-1][1][k]) %= mod;
                }
                (dp[i][0][(k+s)%D] += dp[i-1][0][k]) %= mod;
            }
        }
    }

    // cerr << "debug" << endl;
    // for(int i=0; i<K.length(); i++) {
    //     for(int j=0; j<D; j++) cerr << dp[i][0][j] << " "; cerr << endl;
    // }
    ll ans = (dp[K.length()-1][0][0] + dp[K.length()-1][1][0] - 1 + mod) % mod;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 17024
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
    int n;
    cin>>n;
    if(n/100==n%10)
        printf("Yes\n");
    else
        printf("No");
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
int ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0; }
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
ll nod(ll F) { return log10(F) + 1; }
//**定義場所**//
//gcd, isPrime, eratos, modinv, bitSearch, dfs, bfs, dijkstra, UnionFind//
ll i, j, k, l, m, n; ll N, M, K, H, W, L; string S;
ll MOD = 1000000007; ll ans = 0; ll INF = 9999999999999;
vl flag, color; vll path; vl A, T;
//***********//
int main() {
	cin >> N;
	cin >> S;
	for (i = 0; i < N - 2; i++) {
		string key = S.substr(i, 3);
		if (key == "ABC") {
			ans++;
		}
	}
	cout << ans;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> P;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)

int main(void){
  int c[110]={0};
  int a,b;
  while(cin>>a>>b){
    if(a==0){
      bool f = true;
      if(c[1]%2==0||c[2]%2==0) f = false;
      FOR(i,3,110){
        if(c[i]!=0&&c[i]%2==1){
          f = false;
          break;
        }
      }
      if(f) cout<<"OK"<<endl;
      else cout<<"NG"<<endl;
      REP(i,110)c[i]=0;
    }else{
      c[a]++;
      c[b]++;
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <cctype>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;

int block(string &s, int &i);
int number(string &s, int &i);

int block(string &s, int &i)
{
  i++;
  if(s[i] == '['){
    vector<int> v;
    while(s[i] == '['){
      v.push_back(block(s, i));
      i++;
    }
    sort(v.begin(), v.end());
    return accumulate(v.begin(), v.begin() + v.size()/2+1, 0);
  }else{
    return number(s, i);
  }
}

int number(string &s, int &i)
{
  int n = s[i] - '0';
  i++;
  while(isdigit(s[i])){
    n *= 10;
    n += s[i] - '0';
    i++;
  }
  return n / 2 + 1;
}

int main()
{
  int n;
  cin >> n;
  for(int j = 0; j < n; j++){
    string s;
    cin >> s;
    int i = 0;
    cout << block(s, i) << endl;
  }
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
 
int main(){
	int N;
	string S;
	char W;
	cin >> N >> S;

	N = N % 26;
	
	for (int i =0;i<S.size();i++){
		W = S.at(i)+N;
		if (W >= 0x5b){
			W = W -26;
		}
		cout << W;
	}
	
}

Measured memory_bytes: 256
N,M,X = map(int,input().split())
A = list(map(int, input().split()))
c1 = 0
c2 = 0
for i in range(X):
    if i in A:
        c1 += 1
for i in range(X,N):
    if i in A:
        c2 += 1
print(min(c1,c2))

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

int main(){
    char str[1001];
    
    while(1){
        scanf("%s", str);
        if(str[0] == '0') break;
        
        int sum = 0;
        for(int i =0; i< strlen(str); i++){
            sum += str[i] - '0';
            
        }
        
        printf("%d\n", sum);
    }
    
    return 0;
}


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

int main() {
    ll N;
    cin >> N;
		ll ans = 0;
		if(N%2 == 1){
			cout << ans << endl;
			return 0;
		}

    for (ll f = 10;f<=N;f*=5) {
			ans += N/f;
    }
		cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int A, B;
  cin>>A>>B;
  if(A+B>=10) cout<<"error"<<endl;
  else cout<<A+B<<endl;
}


Measured memory_bytes: 3576
#define LOCAL
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rrep(i, n) for(int i=(n-1); i>=0; --i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define memr(dp, val) memset(dp, val, sizeof(dp))
using namespace std;
typedef long long ll;
static const int INTINF = (INT_MAX >> 1); // 10^9 + 10^7
static const ll LLINF = (LLONG_MAX >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;
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; }
string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define print(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define print(...)
#endif

ll N, K;
vector<ll> A;
vector<ll> used;
vector<ll> ord;
ll loopV = 0;

void dfs(int v){
	if(used[v] == true) {
		loopV = v;
		return;
	}
	used[v] = true;
	ord.push_back(v);
	if(v == -1) dfs(0);
	else dfs(A[v]);
}
int main(int argc, const char * argv[]) {
	std::cout << std::fixed << std::setprecision(15);

	cin >> N >> K;
	A.resize(N);
	used.resize(N);
	rep(i, N) {
		cin >> A[i];
		A[i]--;
	}
	dfs(0);

	ll x = 0;
	rep(i, ord.size()){
		if(ord[i] == loopV){
			x = i;
			break;
		}
	}
	ll y = ord.size() - x;

	if(K < x){
		cout << ord[K] + 1 << endl;
		return 0;
	}
	ll z = (K - x) % y;

	// print(x);
	// print(y);
	// print(z);
	// print(loopV);
	// print(ord);
	// print(1);
	cout << ord[x + z]+1 << endl;
	return 0;
}


Measured memory_bytes: 17176
import java.util.Scanner;
 
public class Main{
    public static void main(String [] args){
        Scanner s = new Scanner(System.in);
        int ans,n,x;
        while(true){
        n = s.nextInt();
        x = s.nextInt();
        if(n==0&&x==0)break;
        ans = solve(0,0,0,n,x);
        System.out.println(ans);
 
         
 
        }
    }
    public static int solve(int nn,int c,int now,int a,int b){
        int sum=0;
        if(nn==10&&now==b&&c==a)return 1;
        if(nn==10)return 0;
        sum += solve(nn+1,c,now,a,b);
        sum += solve(nn+1,c+1,now+nn,a,b);
        return sum;
    }
}



Measured memory_bytes: 26140
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    if(s.find("AC") != string::npos) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

namespace Competition
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var p = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            var res = 0;
            for(var i = 1; i < n - 1; i++)
            {
                var p_l = new List<int>();
                p_l.Add(p[i]); p_l.Add(p[i - 1]); p_l.Add(p[i + 1]);
                p_l.Sort();
                if (p_l[1] == p[i]) res++;
            }
            Console.WriteLine(res);
        }
    }
}


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

int gcd(int A,int B){
    if(B == 0){
        return A;
    }
    return gcd(B,A%B);
}

int main(){
    
    int Len;
    scanf("%d",&Len);

    int count = Len;

    for(int i = 0;i < Len;i++){
        int buff;
        scanf("%d",&buff);
        for(int j = 2;j*j<=buff;j++){
            if(buff % j == 0){
                //printf(" %d\n",buff);
                count--;
                break;
            }
        }
    }
    printf("%d\n",count);

    return 0;
}



Measured memory_bytes: 2700
from itertools import accumulate
from collections import Counter

N = int(input())
lst_A = list(map(int, input().split()))
S = [0] + list(accumulate(lst_A))

ans = 0
for i in Counter(S).values():
    if i > 1:
        # 累積和が等しい集合から2つ選ぶ（nC2 の組み合わせ）
        ans += i * (i - 1) // 2

print(ans)


Measured memory_bytes: 41984
//k_k_dubey_
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
#define inf 999999999999
#define mx 200005
#define gcd __gcd
#define pb push_back
#define mk make_pair
#define bs binary_search
#define ub upper_bound
#define lb lower_bound
#define endl "\n"
#define vl vector<ll>
#define vs vector<string>
#define non __builtin_popcount
#define ml map<ll, ll> 
#define ms map<string , ll> 
using namespace std;

bool isp[mx];

void sv(){

	ll i,j;
	memset(isp, true, sizeof(isp));
	
	isp[1]= false;
	for(i=2;i*i<mx;i++){
		if(isp[i]){
			for(j=i*i;j<mx;j+=i)
			isp[j]= false;
		}
	}
}

ll powr(ll a,ll b)
{
	ll res=1;
	while(b)
	{
		if(b&1)res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	//sv();
	
	ll a,b,i,j,x;
	cin>>a>>b;
	ll ans= (a+b)/2;
	if((a+b)%2){
	    //if(((a+b)/2)&1)
	    ans++;
	}
	cout<<ans;
    return 0;
}























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

typedef struct {
    int x;
    int y;
    int r;
} WALL;

// 内積
#define dotProduct(x1, y1, x2, y2) (( x1 * x2 ) + ( y1 * y2 ))
// 円の中に点があるかどうか
#define inCircle(x1, y1, c) (pow(c.x - x1, 2) + pow(c.y - y1, 2) < c.r * c.r ? 1 : 0)

int judge(WALL w, int tx, int ty, int sx, int sy) {
    //V : 線分始点から終点へのベクトル
    //C : 線分始点から円中心へのベクトル
    int Vx = tx - sx;
    int Vy = ty - sy;
    int Cx = w.x - sx;
    int Cy = w.y - sy;
    int n1, n2, n3;

    int in_t = inCircle(tx, ty, w);
    int in_s = inCircle(sx, sy, w);

    if (in_t && in_s)
	return 0;

    if (in_t || in_s)
	return 1;

    //二つのベクトルの内積を求める
    n1 = dotProduct(Vx, Vy, Cx, Cy);
    n2 = dotProduct(Vx, Vy, Vx, Vy);
    n3 = dotProduct(Cx, Cy, Cx, Cy);

    if (n1 < 0 || n1 > n2) 
	return 0;
    return (n3 - (n1 * n1 / n2) <= pow(w.r, 2)) ? 1 : 0;
}




int main(void) {
    int n;

    while (scanf("%d", &n), n) {
	int i, m;
        WALL w[100];
        for (i = 0; i < n; i++) {
	    scanf("%d%d%d", &w[i].x, &w[i].y, &w[i].r);
	}
	scanf("%d", &m);
        for(i=0; i < m; i++){
            int j, safe = 0;
            int tx, ty, sx, sy;
            scanf("%d%d%d%d", &tx, &ty, &sx, &sy);
 
            for(j = 0 ; j < n; j++)
                if (judge(w[j], tx, ty, sx, sy) == 1) {
                    safe = 1;
                    break;
                }
 
            if (safe)
                printf("Safe\n");
            else
                printf("Danger\n");
        }
    }
 
    return 0;
}

Measured memory_bytes: 584
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        double r = scan.nextDouble();
        double area = r * r * Math.PI;
        double circumference = 2 * r * Math.PI ;
        System.out.printf("%f %f",area, circumference);
        scan.close();
        }
    }


Measured memory_bytes: 28052
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((ll)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
using namespace std;

ll MOD = 1000000007;
ll addmod(ll a, ll b){
  return (a + b) % MOD;
}

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

  vector<ll> dp(N+1,0);
  dp[0] = 1;
  ll last = 0;
  map<ll,ll> mp;
  REP(i,1,N+1){
    ll c;
    cin >> c;
    ll left = mp[c];
    if(c==last) dp[i] = dp[i-1];
    else if(left==0) dp[i] = dp[i-1];
    else{
      dp[i] = addmod(dp[i-1], dp[left]);
    }
    mp[c] = i;
    last = c;
  }
  
  cout << dp[N] << endl;

  return 0;
}


Measured memory_bytes: 14336
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
	while(1){
		int n;
		cin >> n;
		if(n==0) break;
		ll int xcnt = 0;
		ll int data[1001];
		ll int lastxpos = -10;
		REP(i,n){
			string s;
			cin >> s;
			if(s=="x"){
				xcnt++;
				if(lastxpos==i-1){//x 2??£?¶????????????????????????¨
					xcnt = n;
				}
				lastxpos = i;
				data[i]=1000000000;
			}else{
				data[i]= stoll(s);
			}
		}
		if(xcnt>=n){//2??£?¶????????????§?????£?????????
			cout << "none" << endl;
		}else{
			bool is_mujun = false;
			ll int minx=-1000000000,maxx=1000000000;
			REP(i,n){
				if(i==0){
					if(data[0]==1000000000) maxx = data[1]-1;
					else if(data[1]!=1000000000&&data[0]>=data[1]) is_mujun = true;
				}else if(i==n-1){
					if(data[n-1]==1000000000){
						if((n+1)%2==0){
							maxx = min(maxx,data[i-1]-1);
						}else{
							minx = max(minx,data[i-1]+1);
						}
					}else{
						if((n+1)%2==0){
							if(data[n-2]!=1000000000&&data[n-1]>=data[n-2]) is_mujun = true;
						}else{
							if(data[n-2]!=1000000000&&data[n-1]<=data[n-2]) is_mujun = true;
						}						
					}
				}else{
					if(data[i]==1000000000){
						if((i+1)%2==0){
							minx = max(minx,max(data[i-1],data[i+1])+1);
						}else{
							maxx = min(maxx,min(data[i-1],data[i+1])-1);
						}
					}else{
						if((i+1)%2==0){
							if(data[i-1]!=1000000000&&(data[i]<=data[i-1])) is_mujun = true;
							if(data[i+1]!=1000000000&&(data[i]<=data[i+1])) is_mujun = true;
						}else{
							if(data[i-1]!=1000000000&&(data[i]>=data[i-1])) is_mujun = true;
							if(data[i+1]!=1000000000&&(data[i]>=data[i+1])) is_mujun = true;
						}
					}
				}
				if(minx!=-1000000000&&maxx!=1000000000&&minx-maxx>0) is_mujun = true;
				//cout << minx << " " << maxx << " " << is_mujun <<" "<<data[i]<< endl;
			}
			if(xcnt==0){
				if(is_mujun) cout << "none" << endl;
				else cout << "ambiguous" << endl;				
			}else if(xcnt==1){
				cout << "ambiguous" << endl;
			}else{
				if(is_mujun) cout << "none" << endl;
				else{
					if(maxx==minx) cout << maxx << endl;
					else cout << "ambiguous" << endl;
				}
			}

		}
	}
}

Measured memory_bytes: 1224
import collections
N = int(input())
v = list(map(int, input().split()))

if len(set(v)) == 1:
    print(N//2)
else:
    v_gu = v[::2]
    v_ki = v[1::2]
    gu_con = collections.Counter(v_gu)
    ki_con = collections.Counter(v_ki)
    gugu = gu_con.most_common()
    kiki = ki_con.most_common()
    
    if gugu[0][0] != kiki[0][0]:
        print(N-gugu[0][1]-kiki[0][1])
    
    elif len(gugu) == 1 and len(kiki) >=2:
        print(N-gugu[0][1]-kiki[1][1])
        
    elif len(gugu) >= 2 and len(kiki) == 1:
        print(N-gugu[1][1]-kiki[0][1])
    else:
        print(min(N-gugu[0][1]-kiki[1][1],N-gugu[1][1]-kiki[0][1]))

Measured memory_bytes: 23772
#include <stdio.h>

int main(void)
{
  int N,M,l,ch,i,j,x,y,sum,nowx,nowy;
  char d;

  for(;;){
    int gem[21][21]={0};
    sum=0;
    nowx=10;
    nowy=10;
    scanf("%d", &N);
    if(N==0) break;

    for(i=0;i<N;i++){
      scanf("%d %d", &x, &y);
      gem[x][y]++;
    }
    scanf("%d", &M);
    while((ch=getchar())!='\n');
    for(i=0;i<M;i++){
      scanf("%c %d", &d, &l);
      while((ch=getchar())!='\n');
      if(d=='N'){
	for(j=0;j<l;j++){
	  nowy++;
	  if(gem[nowx][nowy]){
	    gem[nowx][nowy]=0;
	    sum++;
	  }
	}
      } else if(d=='E'){
	for(j=0;j<l;j++){
	  nowx++;
	  if(gem[nowx][nowy]==1){
	    gem[nowx][nowy]=0;
	    sum++;
	  }
	}
      } else if(d=='W'){
	for(j=0;j<l;j++){
	  nowx--;
	  if(gem[nowx][nowy]==1){
	    gem[nowx][nowy]=0;
	    sum++;
	  }
	}
      } else if(d=='S'){
	for(j=0;j<l;j++){
	  nowy--;
	  if(gem[nowx][nowy]==1){
	    gem[nowx][nowy]=0;
	    sum++;
	  }
	}
      }
    }
    if(sum==N){
      printf("Yes\n");
    } else {
      printf("No\n");
    }
  }

  return 0;
}


Measured memory_bytes: 588
#include<stdio.h>
int main(){
  int i,h,data[250];
  scanf("%d",&h);
  for(i=0;i<h;++i) scanf("%d",&data[i]);
  for(i=0;i<h;++i){
    printf("node %d:",i+1);
    printf(" key = %d, ",data[i]);
    if(i!=0) printf("parent key = %d, ",data[(i-1)/2]);
    if(i*2+1<h) printf("left key = %d, ",data[i*2+1]);
    if(i*2+2<h) printf("right key = %d, ",data[i*2+2]);
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2740
#include <stdio.h>
#include <string.h>
#include <algorithm>
#define MN 4000
int n,a[MN+5],f[MN+5][MN+5];
int p[MN+5][2];
int b[MN+5][MN+5],c[MN+5][MN+5];
int get(int p,int B,int W){
	return p-b[p][B]-c[p][W];
}
int main(){
	memset(f,0x7f,sizeof(f));
	scanf("%d",&n); n<<=1;
	for(int i=1;i<=n;i++){
		static char s[2];
		static int x;
		scanf("%s%d",&s[0],&x);
		a[i]=(x<<1)|(s[0]=='W');
		p[x][s[0]=='W']=i;
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=(n>>1);j++){
			b[i][j]=b[i-1][j];
			c[i][j]=c[i-1][j];
			if(a[i]&1){
				if((a[i]>>1)<=j) c[i][j]++; //1->白 
			}else{
				if((a[i]>>1)<=j) b[i][j]++; //0->黑 
			}
		}
	}
	f[0][0]=0;
	for(int i=0;i<=(n>>1);i++){
		for(int j=0;j<=(n>>1);j++){
			if(i>0){
				f[i][j]=std::min(f[i][j],f[i-1][j]+get(p[i][0],i,j));
			}
			if(j>0){
				f[i][j]=std::min(f[i][j],f[i][j-1]+get(p[j][1],i,j));
			}
		}
	}
	printf("%d\n",f[n>>1][n>>1]);
}

Measured memory_bytes: 187648
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
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; }

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

    vector<ll> plus(n), minus(n);
    rep(i, n) plus[i] = a[i] + i;
    rep(i, n) minus[i] = i - a[i];

    map<ll, int> m;
    rep(i, n) m[minus[i]]++;

    ll ans = 0;
    rep(i, n) {
        ans += m[plus[i]];
        m[minus[i]]--;
    }
    cout << ans << endl;
}


Measured memory_bytes: 30712