akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        int total = 0;
        for(int i = 1; i <= num; i++) {
        	total += i;
        }
        System.out.println(total);
    }

    static String[] strCompare(String[] array) {
    	Arrays.sort(array, new Comparator<String>() {
    		public int compare(String s1, String s2) {
    			if(compareLength(s1, s2) == 0) {
    				return s1.compareTo(s2);
    			}
    			return compareLength(s1, s2);
    		}
    	});
    	return array;
    }

    static int compareLength(String s1, String s2) {
    	if(s1.length() > s2.length()) {
    		return 1;
    	} else if (s1.length() < s2.length()) {
    		return -1;
    	} else {
    		return 0;
    	}
    }
    
    static String[] strCompareReverse(String[] array) {
    	Arrays.sort(array, new Comparator<String>() {
    		public int compare(String s2, String s1) {
    			if(compareLengthReverse(s1, s2) == 0) {
    				return s1.compareTo(s2);
    			}
    			return compareLengthReverse(s1, s2);
    		}
    	});
    	return array;
    }

    static int compareLengthReverse(String s1, String s2) {
    	if(s1.length() > s2.length()) {
    		return 1;
    	} else if (s1.length() < s2.length()) {
    		return -1;
    	} else {
    		return 0;
    	}
    }

    static int[] toIntArray(String[] str) {
    	int[] num = new int[str.length];
    	for(int i = 0; i < str.length; i++) {
    		num[i] = Integer.parseInt(str[i]);
    	}
    	return num;
    }

    static char[] strToCharArray(String str) {
    	char[] chAr = new char[str.length()];
    	chAr = str.toCharArray();
    	return chAr;
    }


    static String[] toStringArray(String str, String delim) {
    	String[] stAr = str.split(delim);
    	return stAr;
    }

    static int[] strToIntArray(String str, String delim) {
    	String[] strAr = str.split(delim);
    	int[] intAr = new int[strAr.length];
    	for(int i = 0; i < strAr.length; i++) {
    		intAr[i] = Integer.parseInt(strAr[i]);
    	}
    	return intAr;
    }

    static int toInt(String str) {
    	int num = Integer.parseInt(str);
    	return num;
    }

    static double[] strToDoubleArray(String str, String delim) {
    	String[] strAr = str.split(delim);
    	double[] dAr = new double[str.length()];
    	for(int i = 0; i < strAr.length; i++) {
    		dAr[i] = Double.parseDouble(strAr[i]);
    	}
    	return dAr;

    }
}

Measured memory_bytes: 19540
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int n = sc.nextInt();
        double sum = 0.0d;
        for(int i=0; i<n; i++){
            int tmp = sc.nextInt();
            sum += 1.d / (double)tmp;
        }
        System.out.println(1.d / sum);
    }



    private static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;

        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }

        private int readByte() {
            if (hasNextByte())
                return buffer[ptr++];
            else
                return -1;
        }

        private static boolean isPrintableChar(int c) {
            return 33 <= c && c <= 126;
        }

        public boolean hasNext() {
            while (hasNextByte() && !isPrintableChar(buffer[ptr]))
                ptr++;
            return hasNextByte();
        }

        public String next() {
            if (!hasNext())
                throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        public long nextLong() {
            if (!hasNext())
                throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while (true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }

        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
                throw new NumberFormatException();
            return (int) nl;
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }

}



Measured memory_bytes: 21204
/*
Author: Racer5x
 ***************************************   UNAUTHORISED COPYING OF CODE PROHIBITED   **********************************
*/
 
// #pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include<bits/stdc++.h>
#define int         long long
#define double      long double
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define endl        '\n'
#define hell        998244353 
#define PI          3.141592653589
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MAX         2000000000000000000
#define M           1000000007
using namespace std;
 
signed main()
{
    tezz
    
    int n;
    cin>>n;

    vi v(n);
    for(int &x:v) cin>>x;

    int mn = v[0];
    int count = 1;
    for(int i=1;i<n;i++){
        if(v[i] < mn) count++;
        mn = min(mn, v[i]);
    }
    cout<<count;
} 

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

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

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

// const int dx[4] = { 1, 0, -1, 0 };
// const int dy[4] = { 0, 1, 0, -1 };

// const int dx[8] = {1, 1, 0,-1,-1,-1, 0, 1};
// const int dy[8] = {0, 1, 1, 1, 0,-1,-1,-1};

#define SUM(vec) accumulate(all(vec),0LL) // 配列の中身を全部足す
template<typename T>void print(T&& x){cout<<x<<endl;}// 改行付き出力
ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
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 ctoi(char c){return c-'0';}

// TODO: write
int main() {
  string s;cin>>s;
  bool ok = s[1] == s[2];
  ok &= s[0] == s[1] || s[2] == s[3];
  if(ok)print("Yes");
  else print("No");
  return 0;
}



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

int main() {
    long N;
    cin>>N;
    long ans;
    long sum;
    for(long i=1;i<=N;++i){
        if(2*N<=i*(i+1)){
            ans = i;
            sum = i*(i+1)/2;
            break;
        }
    }
    long hiku = sum - N;
    for(int i=1;i<=ans;++i){
        if(i==hiku)continue;
        cout<<i<<endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;

int main(){
    ll h,w; cin >> h >> w;
    vector<string> b(h);
    rep(i,h) cin >> b.at(i);
    vector<vector<ll>> y(h,vector<ll>(w)), t(h,vector<ll>(w));
    rep(i,h){
        ll count = 0;
        rep(j,w){
            if(b.at(i).at(j) == '#'){
                count = 0;
            }else{
                count++;
            }
            y.at(i).at(j) = count;
        }
    }

    for(int i=h-1;i>=0;i--){
        ll val = 0;        
        for(int j=w-1;j>=0;j--){
            if((y.at(i).at(j) != 0 ) && (val == 0)){
                val = y.at(i).at(j);
            }else if(y.at(i).at(j) !=0){
                y.at(i).at(j) = val;
            }else{
                val = 0;
            }
        }
    }


    rep(j,w){
        ll count = 0;
        rep(i,h){
            if(b.at(i).at(j) == '#'){
                count = 0;
            }else{
                count++;
            }
            t.at(i).at(j) = count;
        }
    }

    for(int j=w-1;j>=0;j--){
        ll val = 0;
        for(int i=h-1;i>=0;i--){
            if((t.at(i).at(j) != 0 ) && (val == 0)){
                val = t.at(i).at(j);
            }else if(t.at(i).at(j) !=0){
                t.at(i).at(j) = val;
            }else{
                val = 0;
            }
        }
    }
    ll ans = 0;
    rep(i,h) rep(j,w) ans = max(ans, y.at(i).at(j) + t.at(i).at(j) - 1);
    cout << ans << endl;
    
    /*
    rep(i,h){
        rep(j,w){
            cout << t.at(i).at(j) << " ";
        }
        cout << endl;
    }
    */
}

Measured memory_bytes: 67072
#include <bits/stdc++.h>
#define rep(i,a,n)  for (int i=(int)(a); i<=(int)(n); ++i)
#define rrep(i,a,n) for (int i=(int)(a); i>=(int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) rep(f, 0, (x.size()-1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define all(x) x.begin(),x.end()
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const int MOD = 1000000007;

int N,M,K,X,Y;
int a,b,c,d;
string S,T;
vector<int> A,B;
void input()
{
    cin>>N>>K;
    A.resize(N);
    rep(i,0,N-1){
        cin>>A[i];
    }
}
int mem[999999];
int rec(int n){
    if (mem[n] < INF) {
        return mem[n];
    }
    int minm = INF;
    rep(i,1,K){
        if (n-i >= 0)
        minm = min(rec(n-i) + abs(A[n] - A[n-i]),minm);
    }
    mem[n] = minm;
    return mem[n];


}


void solve()
{
    mem[0] = 0;
    rep(i,1,N+5){
        mem[i]=INF;
    }
    rec(N);
    cout<<rec(N-1)<<endl;

}
signed main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 8064
using System;
using System.Linq;

namespace atcoder {
    class Program {
        static void Main (string[] args)
        {
            ABC139.PowerSocket();
        }
    }

    class ABC139
    {
        public static void PowerSocket()
        {
            var s = Input.getIntArray();
            int a = s[0];
            int b = s[1];

            int tap = 0;
            if(b==1)
            {
                tap = 0;
            }
            else if(b<=a)
            {
                tap +=1 ;
            }
            else
            {
                tap = (int)Math.Ceiling((double)(b-a)/(a-1)) + 1;
            }        

            Console.WriteLine(tap);
        }   
    }

    class Input {
        public static int[] getIntArray () {
            string[] s = Console.ReadLine ().Split (' ');
            int[] num = s.Select (x => int.Parse (x)).ToArray ();
            return num;
        }
        public static long[] getLongArray () {
            string[] s = Console.ReadLine ().Split (' ');
            long[] num = s.Select (x => long.Parse (x)).ToArray ();
            return num;
        }
        public static string[] getStringArray (int n) {
            var s = new string[n];
            for (int i = 0; i < n; i++) {
                s[i] = Console.ReadLine ();
            }
            return s;
        }
    }

}


Measured memory_bytes: 13396
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;

int main(){
  int x, y, s;
  while(true){
    cin >> x >> y >> s;
    if(x == 0)
      break;

    int nmax = 0;
    double c1, c2;
    for(int i=1; i<=s/2; i++){
      c1 = i;
      c2 = s - i;
      c1 = ceil(c1 * 100.0 / (100.0 + x));
      c2 = ceil(c2 * 100.0 / (100.0 + x));
      if((int)(c1 * (100.0 + x) / 100) + (int)(c2 * (100.0 + x) / 100) == s){
        c1 = c1 * (100.0 + y) / 100.0;
        c2 = c2 * (100.0 + y) / 100.0;
        nmax = max(nmax, (int)c1 + (int)c2);
      }
    }

    cout << nmax << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3032
#include <stdio.h>

int main()
{
	int N,i,j,k,cnt=0;
	int L[1000] = { };

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

	for (i = 0; i < N-2; i++) {
		for (j = i+1; j < N-1; j++) {
			for (k = j+1; k < N; k++) {
				if (L[i] != L[j] && L[i] != L[k] && L[j] != L[k] )
				{
					if (L[k] < L[i] + L[j] && L[i] < L[j] + L[k] && L[j] < L[i] + L[k])
						cnt++;
				}
			}
		}
	}

	printf("%d",cnt);
	return 0;
}

Measured memory_bytes: 1652
import java.util.*;

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

    int n = sc.nextInt();
    int count = 1;
    long sum = 0;
    int i = 1;

    do{
      if(i%3!=0&&i%5!=0){
        sum += i;
      }
      count +=1;
      i++;
    }while(count<=n);

    System.out.println(sum);

  }
}

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

int main() {
	int i;
	int min = 1000000001;
	int mem;
	int N, A, B;
	cin >> N;
	for (i = 0; i < N; i++) {
		cin >> A >> B;
		if (min > B) {
			mem = A;
			min = B;
		}
	}
	cout << min + mem << endl;
	return 0;
}

Measured memory_bytes: 256
// 2014/09/10 Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){
		int Y[4], X[4];
		int I = 0;

		for(int y=0; y<8; y++){
			for(int x=0; x<8; x++){
				char c;
				cin >> c;

				if(cin.eof())
					return 0;

				if(c=='1'){
					Y[I] = y;
					X[I] = x;
					I++;
				}
			}
		}
/*
		for(int i=0; i<4; i++){
			cout << Y[i] << ' ' << X[i] << endl;
		}
*/
		if(Y[1]==Y[0] && Y[2]==Y[0]+1 && Y[3]==Y[0]+1 && X[1]==X[0]+1 && X[2]==X[0] && X[3]==X[0]+1){
			cout << 'A' << endl;
		}
		else if(Y[1]==Y[0]+1 && Y[2]==Y[0]+2 && Y[3]==Y[0]+3 && X[1]==X[0] && X[2]==X[0] && X[3]==X[0]){
			cout << 'B' << endl;
		}
		else if(Y[1]==Y[0] && Y[2]==Y[0] && Y[3]==Y[0] && X[1]==X[0]+1 && X[2]==X[0]+2 && X[3]==X[0]+3){
			cout << 'C' << endl;
		}
		else if(Y[1]==Y[0]+1 && Y[2]==Y[0]+1 && Y[3]==Y[0]+2 && X[1]==X[0]-1 && X[2]==X[0] && X[3]==X[0]-1){
			cout << 'D' << endl;
		}
		else if(Y[1]==Y[0] && Y[2]==Y[0]+1 && Y[3]==Y[0]+1 && X[1]==X[0]+1 && X[2]==X[0]+1 && X[3]==X[0]+2){
			cout << 'E' << endl;
		}
		else if(Y[1]==Y[0]+1 && Y[2]==Y[0]+1 && Y[3]==Y[0]+2 && X[1]==X[0] && X[2]==X[0]+1 && X[3]==X[0]+1){
			cout << 'F' << endl;
		}
		else if(Y[1]==Y[0] && Y[2]==Y[0]+1 && Y[3]==Y[0]+1 && X[1]==X[0]+1 && X[2]==X[0]-1 && X[3]==X[0]){
			cout << 'G' << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1132
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

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; }

using ll = long long;

ll N;
ll T[110];

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()
{
  scanf( "%lld", &N );
  rep( i, N )
    scanf( "%lld", T+i );

  ll g = T[0];

  repi( i, 1, N )
  {
    g = lcm( g, T[i] );
  }

  printf( "%lld\n", g );

  return 0;
}

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

int main () {
  int a, b, k;
  cin >> a >> b >> k;
  if (a > b) {
    swap(a, b);  
  }
  vector<int> box;
  for (int i = 1; i <= b; i++) {
    if (a % i == 0 && b % i == 0) {
      box.push_back(i);  
    }  
  }
  reverse(box.begin(), box.end());
  cout << box[k - 1] << endl;
}

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

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

            int edgeCount;
            int outNumber;

            if (n % 2 == 1)
            {
                int n__ = n - 1;
                edgeCount = (n__ * n__) / 2;
                outNumber = n;
            }
            else
            {
                edgeCount = (n - 2) * n / 2;
                outNumber = n + 1;
            }

            Console.WriteLine("{0}", edgeCount);

            for (int y = n; y >= 2; --y)
            {
                for (int x = 1; x <= y - 1; ++x)
                {
                    if (x + y != outNumber)
                    {
                        Console.WriteLine("{0} {1}", x, y);
                    }
                }
            }
        }
    }
}


Measured memory_bytes: 13012
#![allow(unused_mut)]
#![allow(non_snake_case)]
#![allow(unused_macros)]
#![allow(unused_variables)]
#![allow(unused_imports)]
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($y: expr),+) => {
        ::std::cmp::max($x, max!($($y),+))
    };
}

macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($y: expr),+) => {
        ::std::cmp::min($x, max!($($y),+))
    };
}

use std::cmp;
use std::collections::{HashSet, BinaryHeap};
use std::io::{Write, BufWriter, stdout};
use std::iter::FromIterator;
fn main() {
    input! {
        H: usize,
        W: usize,
        c: [[usize; 10]; 10],
        A: [[isize; W]; H],
    }

    let mut distance = [0; 11];
    for start in 0..10 {
        let mut q: HashSet<usize> = HashSet::from_iter(0..10);
        let mut d = [std::usize::MAX; 10];
        d[start] = 0;
        while let Some(&prev) = q.iter().min_by_key(|&&v| d[v]) {
            if prev == 1 { break; }
            q.remove(&prev);
            for &v in q.iter() {
                d[v] = min!(d[v], d[prev] + c[prev][v]);
            }
        }
        distance[start+1] = d[1];
    }

    let ans: usize = A.into_iter().fold(0, |sum, vec| sum + vec.iter().fold(0, |sum, v| sum + distance[(v+1) as usize]));
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<iostream>
using namespace std;
int main() {
  int x,y;
  for(;;){
    cin>>x>>y;
    if(x==0 && y==0) break;
   if(x>y){
      swap(x,y);
      cout<<x<<" "<<y<<endl;
  }  
   else
     cout<<x<<" "<<y<<endl;
  }
  return 0;
}

Measured memory_bytes: 3008
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<math.h>
#include<vector>
#include<queue>
using namespace std;
int main(void){

	int a[100000];
	int b[100000];
	int c, d;
	int k;
	int n, m;
	int s, t;
	int x, y, z;


	scanf("%d", &n);
	s = 0;
	for (int i = 0; i < n; i++){
		scanf("%d %d", &a[i], &b[i]);
		s = b[i] - a[i] + s + 1;
	}

 printf("%d\n",s);

	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <stdlib.h>
#include <map>
#include <deque>
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;


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

	string s;
	cin >> s;
	rep(i, s.size()) {
		repr(j, i + 1, s.size()) {
			if (s[i] == s[j]) {
				cout << "no" << endl;
				return 0;
			}
		}
	}
	cout << "yes" << endl;

	return 0;
}


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

using namespace std;

// Begin {{{
using namespace std;
#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, b, e) for (i64 i = (b), i##_limit = (e); i <= i##_limit; ++i)
#define repr(i, b, e) for (i64 i = (b), i##_limit = (e); i >= i##_limit; --i)
#define var(Type, ...) Type __VA_ARGS__; input(__VA_ARGS__)
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T> using MaxHeap = priority_queue<T>;
template <class T> using MinHeap = priority_queue<T, vector<T>, greater<>>;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
inline i64 sigma(i64 n) { return n * (1 + n) >> 1; }
inline i64 updiv(i64 n, i64 d) { return (n + d - 1) / d; }
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;
#ifndef DEBUG
#define dump(...)
#endif

inline void input() {}
template <class Head, class... Tail>
inline void input(Head&& head, Tail&&... tail) {
    cin >> head;
    input(forward<Tail>(tail)...);
}

inline void outs() { cout << "\n"; }
template <class Head, class... Tail>
inline void outs(Head&& head, Tail&&... tail) {
    cout << head << (sizeof...(tail) ? " " : "");
    outs(forward<Tail>(tail)...);
}

template <class T>
inline void outs(vector<T> &vec) { for (auto &e : vec) cout << e << " \n"[&e == &vec.back()]; }

template <class T>
inline void outs(vector<vector<T>> &df) { for (auto &vec : df) outs(vec); }

inline void outl() { cout << "\n"; }
template <class Head, class... Tail>
inline void outl(Head&& head, Tail&&... tail) {
    cout << head << (sizeof...(tail) ? "\n" : "");
    outl(forward<Tail>(tail)...);
}

template <class T>
inline void outl(vector<T> &vec) { for (auto &e : vec) cout << e << "\n"; }

inline void outn() {}
template <class Head, class... Tail>
inline void outn(Head&& head, Tail&&... tail) {
    cout << head;
    outn(forward<Tail>(tail)...);
}

template <class T>
inline void outn(vector<T> &vec) { for (auto &e : vec) cout << e; }

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}
// }}} End

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    var(int, N);
    var(string, s);
    vector<int> right(N), left(N);
    right[0] = (s[0] == 'W');
    reps(i, 1, N - 1) {
        right[i] = right[i - 1] + (s[i] == 'W');
    }
    left[N - 1] = (s[N - 1] == 'E');
    repr(i, N - 2, 0) {
        left[i] = left[i + 1] + (s[i] == 'E');
    }
    int minv = INF;
    chmin(minv, left[1]);
    chmin(minv, right[N - 2]);
    reps(i, 1, N - 2) {
        chmin(minv, right[i - 1] + left[i + 1]);
    }
    outl(minv);
    return 0;
}


Measured memory_bytes: 2964
import math

n = int(raw_input())
x = map(int, raw_input().split())
y = map(int, raw_input().split())

for i in range(3):
	sum = 0
	for j in range(n):
		sum += (math.fabs(x[j] - y[j]))**(i+1)
		#print("sum = {:}".format(sum))
	ans = sum ** (1.0/(i+1))
	print("{:.6f}".format(ans))

ans = 0
for i in range(n):
	if math.fabs(x[i] - y[i]) > ans:
		ans = math.fabs(x[i] - y[i])
print("{:.6f}".format(ans))

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

#define fi first
#define se second

const int N = 1001;
const int mod = 1e9 + 7;

using namespace std;

vector < int > make(string s)
{
        vector < int > v(26, 0);
        for(int i = 'a'; i <= 'z'; i++){
                int mask = 0, good = 0;
                for(char c: s){
                        if(c == i && !good){
                                good = 1;
                        } else if(good){
                                mask |= (1 << c - 'a');
                        }
                }
                v[i - 'a'] = mask;
        }
        return v;
}

int main()
{
        ios_base::sync_with_stdio(0);

        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);

        string s;
        cin >> s;
        vector < int > a(26, 0);
        int cnt = 0;

        vector < vector < int > > v;

        string last = "";
        for(char c: s){
                int x = c - 'a';
                last += c;
                if(a[x] == 0){
                        a[x] += 1;
                        cnt += 1;
                        if(cnt == 26){
                                for(int i = 0; i < 26; i++){
                                        a[i] = 0;
                                }
                                cnt = 0;
                                v.push_back(make(last));
                                last = "";
                        }
                }
        }

        vector < int > d((int)v.size() + 1, 0);
        for(int i = 0; i < 26; i++){
                if(a[i] == 0){
                        d.back() |= (1 << i);
                }
        }
        for(int i = v.size() - 1; i >= 0; i--){
                for(int j = 0; j < 26; j++){
                        if(d[i + 1] != (d[i + 1] & v[i][j])){
                                d[i] |= (1 << j);
                        }
                }
        }
        string res = "";
        int blocked = 0;
        for(int i = 0; i <= v.size(); i++){
                for(int j = 0; j < 26; j++) if(!(blocked & (1 << j))){
                        if(d[i] & (1 << j)){
                                res += char('a' + j);
                                if(i < v.size()){
                                        blocked = v[i][j];
                                }
                                break;
                        }
                }
        }
        cout << res << "\n";
}


Measured memory_bytes: 1556
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>

using namespace std;

int main()
{
    int h,w;
    char str[206][206];
    cin>>h>>w;
    getchar();
    for(int i=1; i<=h; i++)
    {
        for(int j=1; j<=w; j++)
        {
            str[i][j]=getchar();
        }
        getchar();
    }
    for(int i=1; i<=2*h; i++)
    {//cout<<2*h;
        for(int j=1; j<=w; j++)
        {
            cout<<str[int(floor((i+1.0)/2))][j];
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 3196
#include "bits/stdc++.h"
using namespace std;
#ifdef ONLINE_JUDGE
#define trace(...)
#endif

using LL = long long;

int a[2000];
int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);

	int n; cin >> n;
	for (int i = 0; i < n; i++) cin >> a[i];
	sort(a, a + n);

	LL ans = 0;
	for (int i = 0; i < n; i++) {
		int k = i + 1;
		for (int j = i + 1; j < n; j++) {
			while (k < n && a[k] < a[i] + a[j]) {
				k++;
			}
			ans += max(0, k - j - 1);
		}
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
int a,b,c;
cin>>a>>b>>c;
	
	
if((a+b==c)||(a+c==b)||b+c==a){
	cout<<"Yes";
	return 0;
}	
cout<<"No";	
	return 0;
}

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

int main(){
    int N;
    cin>>N;
    vector<vector<int>> G(N);
    for(int i=0;i<N-1;i++){
        int a,b;
        cin>>a>>b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    vector<int> C(N);
    for(auto &c:C) cin>>c;
    sort(C.begin(), C.end(),greater<int>());
    int64_t M=0;
    for(int i=1;i<N;i++) M+=C[i];
    vector<int> visited(N,0);
    vector<int> ans(N);
    queue<int> que;
    que.push(0);
    visited[0]=1;
    auto ite=C.begin();
    while(!que.empty()){
        int v=que.front();que.pop();
        ans[v]=*ite;
        ite++;
        for(auto &to:G[v]){
            if(!visited[to]){
                visited[to]=true;
                que.push(to);
            }
        }
    }
    cout<<M<<endl;
    for(int i=0;i<N;i++){
        if(i)cout<<' ';
        cout<<ans[i];
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <cassert>
#include <cctype>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <deque>
#include <functional>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#include <fstream>
#include <iostream>
#include <sstream>

#include <iomanip>

using namespace std;

typedef pair<int, int> pint;
typedef vector<int> vint;
typedef long long ll;

#define ALL(c) (c).begin(),(c).end()
#define RALL(c) (c).rbegin(),(c).rend()
#define SORT(c) sort(ALL(c))

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

#define NEXTP(c) next_permutation(ALL(c))
#define SUM(c) accumulate(ALL(c),0)
#define MP( a, b ) make_pair( ( a ), ( b ) )

#define DUMP(x)  cerr << #x << " = " << (x) << endl;

#define INF 1000000000 // 10^9
const double EPS = 1e-10;

int H,W;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
vector<string> board;

//Template End
void dfs(int x,int y, char f){
    board[x][y]='x';
    REP(i, 4){
        int nx=x+dx[i],ny=y+dy[i];
        if (0<=nx&&nx<H&&
            0<=ny&&ny<W&&
            board[nx][ny]==f) {
            dfs(nx, ny, f);
        }
    }
}

int main(){
    while (1) {
        cin>>H>>W;
        
        if (H==0&&W==0) break;
        
        board.clear();
        board.resize(H);
        
        REP(i, H)cin>>board[i];
        
        int ret = 0;

        REP(i,H){
            REP(j, W){
                if(board[i][j]!='x'){
                    ret++;
                    dfs(i,j,board[i][j]);
                }
            }
        }
        cout<<ret<<endl;
    }
    return 0;
}

Measured memory_bytes: 2164
#include<stdio.h>
#define MOD 1000000000000000000

int main()
{
  int N;
  scanf("%d",&N);
  long A[N],temp=1,temp2;
  int flag=0;
  for(int i=0;i<N;i++){
    scanf("%ld",&A[i]);
    if(A[i]==0){
      flag=1;
    }
  }
  
  if(flag==1){
    temp=0;
  }else{
    for(int i=0;i<N;i++){
      if(temp > MOD || (A[i]>MOD/temp)){
        temp=-1;
        break;
      }
      temp*=A[i];
    }
  }
  printf("%ld",temp);
}


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

int main(){
    int N;
    cin >> N;
    vector<int>A(N), B(N), C(N);
    for(int i = 0; i < N; i++)cin >> A[i];
    for(int i = 0; i < N; i++)cin >> B[i];
    for(int i = 0; i < N; i++)cin >> C[i];
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());
    ll ans = 0;
    ll a = 0, c = 0;
    for(ll b = 0; b < B.size(); b++){
        while(a + 1 < A.size() && A[a + 1] < B[b])a++;
        while(c + 1 < C.size() && C[c] <= B[b])c++;
        if(A[a] < B[b] && B[b] < C[c]){
            ans += (a + 1) * (C.size() - c);
        }
    }
    cout << ans << endl;

    return 0;
}


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

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define EACH(begin, end) for(auto itr = (begin); itr != (end); itr++)

/* function */
#define in(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;



ll N = 0;
ll ret = 0;
ll A, B, Q;
vector<ll> s;
vector<ll> t;
vector<ll> x;

void input() {
  s.push_back(-LINF);
  t.push_back(-LINF);

  in(A);
  in(B);
  in(Q);

  ll temp;
  REP(i,A){
    in(temp);
    s.push_back(temp);
  }
  REP(i,B){
    in(temp);
    t.push_back(temp);
  }
  REP(i,Q){
    in(temp);
    x.push_back(temp);
  }

  s.push_back(LINF);
  t.push_back(LINF);
}

void solve(ll pos) {
  ll indexA=0, indexB=0; //スタートより奥で一番近い寺や神社のindex
  
  auto s_itr = upper_bound(s.begin(), s.end(), pos);
  auto t_itr = upper_bound(t.begin(), t.end(), pos);

  // DEBUG(indexA);
  // DEBUG(indexB);


  //s
  ll a = *s_itr - pos; //東
  ll b = pos - *(s_itr - 1); //西
  //t
  ll c = *t_itr - pos; //東
  ll d = pos - *(t_itr - 1); //西

  // DEBUG(a);
  // DEBUG(b);
  // DEBUG(c);
  // DEBUG(d);

  ll r1 = max(a, c);
  ll r2 = 2*a + d;
  ll r3 = 2*c + b;
  ll r4 = 2*b + c;
  ll r5 = 2*d + a;
  ll r6 = max(b, d);

  ll Min = min(min(min(r1, r2), min(r3, r4)), min(r5, r6));
  PRINT(Min);
}

int main(void){
  input();
  REP(i,Q) solve(x[i]);
}


Measured memory_bytes: 3828
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>
#include<assert.h>

using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
//SOLVE


void solve(void)
{
  int N;
  cin>>N;
  vector<int> A (N+1,0);
  for (int i = 0;i< N+1; i++)
  {
     cin>>A[i];
  }
  vector<int> B (N,0);
  for (int i = 0; i < N; i++)
  {
     cin>>B[i];
  }
  int ANS = 0;
  for (int i = 0; i < N; i++)
  {
    ANS += min(A[i],B[i]);
    A[i] -= B[i];
    if(A[i] < 0)
    {
      B[i] = -1*A[i];
    }
    else continue;

    ANS += min(A[i+1],B[i]);
    A[i+1] = max(0LL,A[i+1] - B[i]);
  }
  cout<<ANS<<endl;
  return;
}

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

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


Measured memory_bytes: 1792
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h,w,n;
    cin >> w >> h >> n;
    int l=0,r=w,u=h,d=0;
    REP(i,n){
        int x,y,a;
        cin >> x >> y >> a;
        if(a==1){
            l = max(l,x);
        }else if(a==2){
            r = min(r,x);
        }else if(a==3){
            d = max(d,y);
        }else if(a==4){
            u = min(u,y);
        }
    }
    cout << max(0,r-l) * max(0,u-d) << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int in = 1;
		int ct = 1;
		if(b == 1){
			ct = 0;
		}else if(a >= b){

		}else{
			ct = 0;
			do{
				in += a -1;
				ct ++;
			}while(in < b);
		}
		System.out.println(ct);
	}


}

Measured memory_bytes: 35624
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int y,m,d;
		while(sc.hasNext()){
			y=sc.nextInt();
			m=sc.nextInt();
			d=sc.nextInt();
			//heisei
			if(1990<y) System.out.printf("heisei %d %d %d\n",y-1988,m,d);
			else if(y==1989 && 1<m) System.out.printf("heisei 1 %d %d\n",m,d);
			else if(y==1989 && m==1 && 7<d) System.out.printf("heisei 1 %d %d\n",m,d);
			//showa
			else if(1927<y) System.out.printf("showa %d %d %d\n",y-1925,m,d);
			else if(y==1926 && m==12 && 24<d) System.out.printf("showa 1 %d %d\n",m,d);
			//taisyo
			else if(1913<y) System.out.printf("taisho %d %d %d\n",y-1911,m,d);
			else if(y==1912 && 7<m) System.out.printf("taisho 1 %d %d\n",m,d);
			else if(y==1912 && m==7 && 29<d) System.out.printf("taisho 1 %d %d\n",m,d);
			//
			else if(1869<y) System.out.printf("meiji %d %d %d\n",y-1867,m,d);
			else if(y==1868 && 9<m) System.out.printf("meiji 1 %d %d\n",m,d);
			else if(y==1868 && m==9 && 7<d) System.out.printf("meiji 1 %d %d\n",m,d);
			else System.out.printf("pre-meiji\n");
		}
	}
}

Measured memory_bytes: 0
#include <iostream>

#include <cmath>
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)

using namespace std;

class Point {
public:
	double x, y;
	Point(double x = 0, double y = 0) : x(x), y(y) {}

	Point operator + (Point p) { return Point(x + p.x, y + p.y); }
	Point operator - (Point p) { return Point(x - p.x, y - p.y); }
	Point operator * (double a) { return Point(a*x, a*y); }
	Point operator / (double a) { return Point(x / a, y / a); }

	double norm() { return x*x + y*y; }
	double abs() { return sqrt(norm()); }

	bool operator < (const Point &p) const {
		return x != p.x ? x < p.x : y < p.y;
	}

	bool operator == (const Point &p) const {
		return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
	}
};

typedef Point Vector;

struct Segment{
	Point p1, p2;
};

typedef Segment Line;

class Circle {
public:
	Point c;
	double r;
	Circle(Point c = Point(), double r = 0.0) : c(c), r(r) {}
};


double dot(Vector a, Vector b) {
	return a.x*b.x + a.y*b.y;
}

double cross(Vector a, Vector b) {
	return a.x*b.y - a.y*b.x;
}

bool isOrthogonal(Vector a, Vector b) {
	return equals(dot(a, b), 0.0);
}

bool isOrthogonal(Point a1, Point a2, Point b1, Point b2) {
	return isOrthogonal(a1 - a2, b1 - b2);
}

bool isOrthogonal(Segment s1, Segment s2) {
	return isOrthogonal(s1.p1, s1.p2, s2.p1, s2.p2);
}

bool isParallel(Vector a, Vector b) {
	return equals(cross(a, b), 0.0);
}

bool isParallel(Point a1, Point a2, Point b1, Point b2) {
	return isParallel(a1 - a2, b1 - b2);
}

bool isParallel(Segment s1, Segment s2) {
	return isParallel(s1.p1, s1.p2, s2.p1, s2.p2);
}

int main() {
	int q;
	Line l1, l2;
	cin >> q;
	for (int i = 0; i < q; i++) {
		cin >> l1.p1.x >> l1.p1.y >> l1.p2.x >> l1.p2.y >> l2.p1.x >> l2.p1.y >> l2.p2.x >> l2.p2.y;
		if (isParallel(l1, l2)) {
			cout << 2 << endl;
		}
		else if (isOrthogonal(l1, l2)) {
			cout << 1 << endl;
		}
		else {
			cout << 0 << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1232
// 見せてやるぜ、奇跡ってやつをよぉ……
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const ll MOD = 998244353;
const ll HIGHINF = (ll)1e18;

ll modpow(ll p, ll m) {
    if (m == 0) return 1;
    ll tmp = modpow(p, m/2);
    if (m % 2 == 1) return (tmp * tmp % MOD) * p % MOD;
    else return tmp * tmp % MOD;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    vll d(n); REP(i, n) cin >> d[i];
    
    if (d[0] != 0) {
        cout << "0\n";
    } else {
        map<ll, ll> nc;
        sort(ALL(d));
        nc[0] = 1;
        for (ll i=1; i<n; i++) {
            if (d[i-1] + 1 == d[i] || d[i-1] == d[i]) {
                nc[d[i]]++;
            } else {
                cout << "0\n";
                return 0;
            }
        }
        if (nc[0] != 1) {
            cout << "0\n";
            return 0;
        }

        ll ans = 1, prev = 1;
        for (P<ll, ll> c: nc) { 
            ans *= modpow(prev, c.second);
            ans %= MOD;
            prev = c.second;
        }
        cout << ans << '\n';
    }
    return 0;
}


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

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  string s;
  cin >> s;

  string sr(s);
  reverse(sr.begin(), sr.end());

  string l = s.substr(0, (s.size() - 1) / 2);
  string lr(l);
  reverse(lr.begin(), lr.end());

  string r = s.substr((s.size() + 3) / 2 - 1, s.size());
  string rr(r);
  reverse(rr.begin(), rr.end());

  // printf("%s %s %s %s\n", l.c_str(), lr.c_str(), r.c_str(), rr.c_str());

  bool ok = s == sr && l == lr && r == rr;

  cout << (ok ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256