akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main(){
  int H,W;
  cin >>H>>W;
  string board[50];
  for(int i = 0;i<H;i++){
    cin>>board[i];
  }
  const int dx[8] = {1,0,-1,0,1,-1,-1,1};
  const int dy[8] = {0,1,0,-1,1,1,-1,-1};
  
  for(int i = 0;i<H;i++){
    for(int j = 0;j<W;j++){
      if(board[i][j] == '#'){continue;}
      int num = 0;
      for(int d = 0;d<8;d++){
        int ni = i + dx[d];
        int nj = j + dy[d];
        
        if(ni < 0 || H <= ni){continue;}
        if(nj < 0 || W <= nj){continue;}
        
        if(board[ni][nj] == '#' ){num++;}
        
      }
      board[i][j] = char(num + '0');
    }
  }
  
  for (int i = 0;i<H;i++){
    cout << board[i] << endl;
  }
  return 0;
}
      
  

Measured memory_bytes: 256
a, b, c = map(int, input().split())
k = int(input())

r = 0
while a >= b:
    r += 1
    b *= 2
    if r > k:
        break
while b >= c:
    r += 1
    c *= 2
    if r > k:
        break
if r <= k:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 61328
#include<iostream>
#include<cstdio>
using namespace std;
double ans;
int ori[22],a[22],n;
void dfs(int i,double maxr)
{
    if (i==n){ans=maxr;return;}
    int add,sub,now=a[i];
    if (a[i]>a[i-1])
    {
        add=a[i-1]-now%a[i-1];
        sub=a[i]%a[i-1];
        while (true)
        {
            a[i]=now-sub;
            if (double(sub)/(double)ori[i]>ans||a[i]<a[i-1])break;
            dfs(i+1,max(maxr,double(sub)/(double)ori[i]));
            sub+=a[i-1];
        }
    }
    else add=a[i-1]-a[i];
    while (true)
    {
        if ((double)add/(double)ori[i]>ans)break;
        a[i]=now+add;
        dfs(i+1,max(maxr,(double)add/(double)ori[i]));
        add+=a[i-1];
    }
    a[i]=now;
}
int main()
{
    while (scanf("%d",&n)!=EOF)
    {
        for (int i=0;i<n;i++)
        {
            scanf("%d",&ori[i]);
            a[i]=ori[i];
        }
        ans=1e18;
        dfs(1,0);
        int add=1;
        double radio;
        while (true)
        {
            radio=(double)add/(double)ori[0];
            if (radio>ans)break;
            a[0]=ori[0]+add;
            dfs(1,radio);
            a[0]=ori[0]-add;
            dfs(1,radio);
            add++;
        }
        printf("%.10lf\n",ans);
    }
    return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
	#include <cstdio>
	#include <cstring>
	#include <cmath>
	#include <cstring>
	#include <chrono>
	#include <complex>
	#define endl "\n"
	#define ll long long int
	#define vi vector<int>
	#define vll vector<ll>
	#define vvi vector < vi >
	#define pii pair<int,int>
	#define pll pair<long long, long long>
	#define mod 1000000007
	#define inf 1000000000000000001;
	#define all(c) c.begin(),c.end()
	#define mp(x,y) make_pair(x,y)
	#define mem(a,val) memset(a,val,sizeof(a))
	#define eb emplace_back
	#define f first
	#define s second
	
	using namespace std;
	int main()
	{
		std::ios::sync_with_stdio(false);
		cout<<fixed<<setprecision(20);
		int n;
		cin>>n;
		cout<<2*3.141592653589793238*n<<endl;
		return 0;
	}


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

int main() {
  int N, n, k = 0, m = 1;
  cin >> N;
  k = pow(3, N);
  while (N--) {
    cin >> n;
    if (n % 2 == 0) m *= 2;
  }
  cout << (k - m) << endl;
  return 0;
}

Measured memory_bytes: 640
#define _GLIBCXX_DEBUG
#include <iostream>
#include <string>
#include <cstdint>
#include <bitset>
using namespace std;
using i64 = int64_t;

int main(void){
    string s;
    cin >> s;
    i64 sum = 0;
    int n = s.size()-1;
    for(int bit=0; bit<(1<<n); bit++){
        bitset<9> bs(bit);
        string t = {s[0]};
        for(int i=1; i<=n; i++){
            if(bs.test(i-1)){
                sum += stoll(t);
                t = s[i];
            }
            else t += s[i];
        }
        sum += stoll(t);
    }
    cout << sum << '\n';
    return 0;
}

Measured memory_bytes: 3624
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {

    public static void main(String[] args) throws IOException {
        try (InputReader reader = new InputReader(System.in)) {
            solve(reader);
        }
    }

    private static void solve(InputReader reader) throws IOException {
        int n = reader.readInt();
        int[] as = reader.readIntsSplitByDelimiter(" ");

        int min = as[0];
        int max = as[0];

        for (int i = 1; i < n; i++) {
            min = Math.min(min, as[i]);
            max = Math.max(max, as[i]);
        }

        System.out.println(max - min);
    }
}

class Util {
    static int gcd(int m, int n) {
        int min = Math.min(m, n);
        int max = Math.max(m, n);
        while (min != 0) {
            int tmp = min;
            min = max % tmp;
            max = tmp;
        }

        return max;
    }

    static int lcm(int m, int n) {
        return m / gcd(m, n) * n;
    }
}

class InputReader implements Closeable, AutoCloseable {
    private final BufferedReader br;

    InputReader(InputStream inputStream) {
        this.br = new BufferedReader(new InputStreamReader(inputStream));
    }

    String readLine() throws IOException {
        return this.br.readLine();
    }

    int readInt() throws IOException {
        return Integer.parseInt(this.readLine());
    }

    long readLong() throws IOException {
        return Long.parseLong(this.readLine());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(this.readLine());
    }

    String[] readStringsSplitByDelimiter(String delimiter) throws IOException {
        return this.readLine().split(delimiter);
    }

    int[] readIntsSplitByDelimiter(String delimiter) throws IOException {
        String[] strings = this.readStringsSplitByDelimiter(delimiter);

        int stringsLength = strings.length;
        int[] ints = new int[stringsLength];
        for (int i = 0; i < stringsLength; i++) {
            ints[i] = Integer.parseInt(strings[i]);
        }

        return ints;
    }

    long[] readLongsSplitByDelimiter(String delimiter) throws IOException {
        String[] strings = this.readStringsSplitByDelimiter(delimiter);

        int stringsLength = strings.length;
        long[] longs = new long[stringsLength];
        for (int i = 0; i < stringsLength; i++) {
            longs[i] = Long.parseLong(strings[i]);
        }

        return longs;
    }

    double[] readDoublesSplitByDelimiter(String delimiter) throws IOException {
        String[] strings = this.readStringsSplitByDelimiter(delimiter);

        int stringsLength = strings.length;
        double[] doubles = new double[stringsLength];
        for (int i = 0; i < stringsLength; i++) {
            doubles[i] = Double.parseDouble(strings[i]);
        }

        return doubles;
    }

    @Override
    public void close() throws IOException {
        this.br.close();
    }
}


Measured memory_bytes: 21204
{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
import qualified Data.ByteString.Char8 as BC
import qualified Data.IntMap           as IM
import           Data.List             (group, sort)
import           Data.Maybe            (fromJust)

main :: IO ()
main = do
  [n, k] <- readInts
  as <- readInts
  print $ solve n k as

readInts :: IO [Int]
readInts = map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine

solve :: Int -> Int -> [Int] -> Int
solve n k as = sum $ take (l - k) cs where
  cs = sort . map length . group $ sort as
  l = length cs

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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] A = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            Trace(A);

            for (int i = 1; i < n; i++)
            {
                int v = A[i];
                int j = i - 1;

                while (j >= 0 && A[j] > v)
                {
                    A[j + 1] = A[j];
                    j--;
                }

                A[j + 1] = v;

                Trace(A);
            }
        }

        static void Trace(int[] a)
        {
            Console.Write(a[0]);

            for (int i = 1; i < a.Length; i++)
            {
                Console.Write(" " + a[i]);
            }

            Console.WriteLine();
        }
    }
}

Measured memory_bytes: 9304
#include <iostream>

using namespace std;

int f0[100005], f1[100005];

int main()
{
    int n, a0=0, a1=0, x, s;
    cin>>n;
    int v[n];
    for(int i=0; i<n; i++){
        cin>>v[i];
        if(i%2==0)
            f0[v[i]]++;
        else
            f1[v[i]]++;
    }

    for(int i=0; i<100005; i++){
        if(f0[i]>a0){
            a0=f0[i];
            x=i;
        }
    }

    for(int i=0; i<100005; i++){
        if(i==x)
            continue;
        else
            if(f1[i]>a1)
                a1=f1[i];
    }
    s=n-a0-a1;

    a0=0; a1=0;
    for(int i=0; i<100005; i++){
        if(f1[i]>a1){
            a1=f1[i];
            x=i;
        }
    }

    for(int i=0; i<100005; i++){
        if(i==x)
            continue;
        else
            if(f0[i]>a0)
                a0=f0[i];
    }
    if(n-a0-a1<s)
        s=n-a0-a1;
    cout<<s;

    return 0;
}


Measured memory_bytes: 1408
#ifdef _WIN32
#include "stdc++.h"
#else
#include <bits/stdc++.h>
#endif

// 継承可能な型
template <class Type>
struct IN : Type
{
	IN()
	{
		std::cin >> *this;
	}
};

// 継承不可能な型
template <class Type>
struct IN_
{
	Type val;

	IN_()
	{
		std::cin >> val;
	}

	operator Type&()
	{
		return val;
	}

	IN_<Type>& operator=(const Type& _value)
	{
		val = _value;
		return *this;
	}
};

template <class Char, class Type>
std::basic_ostream<Char>& operator <<(std::basic_ostream<Char>& os, const IN_<Type>& value)
{
	return os << value.val;
}

template <class Char, class Type>
std::basic_istream<Char>& operator >>(std::basic_istream<Char>& is, IN_<Type>& value)
{
	return is >> value.val;
}

template <class Type>
void OUT(const Type& value)
{
	std::cout << value << std::endl;
}

template <class Type, class ... Args>
void OUT(const Type& value, const Args& ... args)
{
	std::cout << value << ' ';
	OUT(args...);
}

void Yes()
{
	OUT("Yes");
}
void No()
{
	OUT("No");
}

using ll = long long;
using inll = IN_<ll>;
using vll = std::vector<ll>;
using setll = std::set<ll>;
using msetll = std::multiset<ll>;
using instr = IN<std::string>;

#define FOR(i, m, n) for (ll (i) = (m); (i) < (n); ++(i))
#define REP(i, n) for (ll (i) = 0; (i) < (n); ++(i))
#define REPR(i, n) for (ll (i) = (n); (i) >= 0; --(i))
#define ITRREP(it, v) for (auto (it) = (v).begin(); (it) != (v).end(); ++(it))
#define ITRREPR(it, v) for (auto (it) = (v).rbegin(); (it) != (v).rend(); ++(it))
#define DIVUP(a, b) (((a) + (b) - 1) / (b))

void Main();

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

	Main();

#ifdef _DEBUG
	system("pause");
#endif

	return 0;
}

using namespace std;

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

void Main()
{
	inll a, b;

	return OUT(max({ a + b, a*b,a-b }));
}


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

using namespace std;
typedef long long int lld;
vector<int> nei[1000000];
int n;
int main(){
  cin>>n;
  for(int i=0;i<n-1;i++){
    int x,y;
    cin>>x>>y;
    x--;y--;
    nei[x].push_back(y);
    nei[y].push_back(x);
  }
  queue<int> q;
  q.push(0);
  int dist[n];
  for(int i=0;i<n;i++)dist[i]=-1;
  dist[0]=0;
  int nxt=0;
  while(!q.empty()){
    int u=q.front();q.pop();
    nxt=u;
    for(int i=0;i<nei[u].size();i++){
      int v=nei[u][i];
      if(dist[v]==-1){
	dist[v]=dist[u]+1;
	q.push(v);
      }
    }
  }
  for(int i=0;i<n;i++)dist[i]=-1;
  dist[nxt]=0;
  q.push(nxt);
  int diam=0;
  while(!q.empty()){
    int u=q.front();q.pop();
    diam=dist[u];
    for(int i=0;i<nei[u].size();i++){
      int v=nei[u][i];
      if(dist[v]==-1){
	dist[v]=dist[u]+1;
	q.push(v);
      }
    }
  }
  if(diam%3==1)cout<<"Second"<<endl;
  else cout<<"First"<<endl;
  return 0;
}

Measured memory_bytes: 32372
from collections import defaultdict


def prime_factor(n):
    # O(sqrt(N))
    d = defaultdict(int)
    for i in range(2, n + 1):
        if i * i > n:
            break

        while n % i == 0:
            d[i] += 1
            n //= i

    if n != 1:
        d[n] += 1

    return d


MAX = 2 * 10 ** 5 + 10
MOD = 10 ** 9 + 7

# Factorial
fac = [0] * (MAX + 1)
fac[0] = 1
fac[1] = 1

# Inverse
inv = [0] * (MAX + 1)
inv[1] = 1

# Inverse factorial
finv = [0] * (MAX + 1)
finv[0] = 1
finv[1] = 1

for i in range(2, MAX + 1):
    fac[i] = fac[i - 1] * i % MOD
    inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
    finv[i] = finv[i - 1] * inv[i] % MOD


def comb(n, k):
    if n < k or k < 0:
        return 0
    return (fac[n] * finv[k] * finv[n - k]) % MOD


def comb_rep(n, k):
    return comb(n + k - 1, n - 1)


N, M = map(int, input().split())
primes = prime_factor(M)
res = 1
for k in primes.values():
    res *= comb_rep(N, k)
    res %= MOD

print(res)


Measured memory_bytes: 72908
#include <bits/stdc++.h>
#define rep(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 A,B,K;
	cin >> A >> B >> K;
	ll ansA = max(0LL,A-K);
	ll ansB = 0;
	if(A>=K) ansB = B;
	else ansB = max(B - (K-A),0LL);
  cout << ansA  << " " << ansB << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long f[90];
int n;
int main()
{
	f[0]=2;f[1]=1;
	cin>>n;
	for(int i=2;i<=n;i++)f[i]=f[i-1]+f[i-2];
	cout<<f[n]<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
/*
void insersionSort(int *a,int n){
    for(int i=1;i<n-1;i++){
        int p=a[i];
        int j=i-1;
        while(j>=0 && a[j]>p){
            a[j+1]=a[j];
            j--;
        }
        a[j]=p;
        for(int i=0;i<n;i++) cout << a[i] << " ";
        cout << endl;
    }
}
*/
int main(){
    int n;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++) cin >> a[i];
    for(int i=0;i<n;i++) {
        cout << a[i];
        if(i!=n-1)cout << " ";
        else cout << endl;
    }
    
    for(int i=1;i<n;i++){
        int p=a[i];
        int j=i-1;
        while(j>=0 && a[j]>p){
            a[j+1]=a[j];
            j--;
        }
        a[j+1]=p;
        for(int i=0;i<n;i++){
            cout << a[i];
            if(i!=n-1)cout << " ";
            else cout << endl;
        } 
    }
    return 0;
}


Measured memory_bytes: 3056
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
import random
from collections import deque
from decimal import *
import queue

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

def main():
	N = inputInt()

	ans = [0 for i in range(N)]
	for x in range(1,100+1):
		for y in range(1,100+1):
			for z in range(1,100+1):
				tmp = x**2 + y**2 + z**2 + x*y + y*z + z*x

				if tmp <= N:
					ans[tmp-1] += 1

	for i in ans:
		print(i)
		
if __name__ == "__main__":
	main()


Measured memory_bytes: 78528
#include <algorithm>
#include <cassert>
// #include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
// #include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
/*
unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 g1.seed(seed1);
*/
using namespace std;

typedef unsigned long ul;
typedef pair<ul, ul> P;
map<int, int> dp;
#define REP(i,n) for(int i=0;i<n;i++)

ul N, M, K;
ul cnt;
ul a;
ul ans = 0;
ul Ktmp;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> N >> K;


    Ktmp = K;
    if (Ktmp % 2 == 0) {
      a = Ktmp/2;
      cnt = max(int((N-a) /K + 1), 0);
      ans += pow(cnt, 3);
      Ktmp = a;
    }
    cnt = max(int(N / K), 0);
    ans += pow(cnt, 3);
    cout << ans << endl;
}

Measured memory_bytes: 640
import java.util.Scanner;

class Main {
    public static void main( String[] args ) {
    	int[] data = new int[ 10 ], top3 = new int[ 3 ];
    
    	Scanner stdIn = new Scanner( System.in );

    	for( int i = 0; i < 10; i++ )
    		data[ i ] = stdIn.nextInt();

		for ( int i = 0; i < 3; i++ ) {
			int max = data[ 0 ], idx = 0;

			for ( int j = 1; j < 10 - i; j++ )
				if ( max < data[ j ] )
					max = data[ idx = j ];
			top3[ i ] = max;

			for ( int j = idx; j < 9 - i; j++ )
				data[ j ] = data[ j + 1 ];
		}

		for( int i = 0; i < 3; i++ )
			System.out.println( top3[ i ] );
    }
}

Measured memory_bytes: 17168
from bisect import bisect as B
I=lambda z:[int(input()) for _ in range(z)]
a,b,q=map(int,input().split())
F=float("inf")
s=[-F]+I(a)+[F];t=[-F]+I(b)+[F];X=I(q)
for x in X:
	i=B(s,x);j=B(t,x)
	o,p=x-s[i-1],s[i]-x
	q,r=x-t[j-1],t[j]-x
	print(min(2*o+r,o+r*2,2*p+q,p+q*2,max(o,q),max(p,r)))

Measured memory_bytes: 17552
import java.awt.Point;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        while (true) {
            int t = sc.nextInt();
            int n = sc.nextInt();
            if ((t | n) == 0)
                break;
            int[][] map = new int[121][121];
            boolean[][] visited = new boolean[121][121];
            for (int i = 0; i < n; i++) {
                int x = sc.nextInt();
                int y = sc.nextInt();
                map[y + 60][x + 60] = -1;
            }
            Queue<Point> q = new LinkedList<Point>();
            int sx = sc.nextInt() + 60;
            int ans = 0;
            int sy = sc.nextInt() + 60;
            q.add(new Point(sx, sy));
            visited[sy][sx] = true;
            while (!q.isEmpty()) {
                Point p = q.poll();
                int x = p.x;
                int y = p.y;
                if (map[y][x] > t)
                    continue;
                ans++;
                int dx[] = { 1, 1, 0, -1, -1, 0 };
                int dy[] = { 0, 1, 1, 0, -1, -1 };
                for (int i = 0; i < 6; i++) {
                    int nx = x + dx[i];
                    int ny = y + dy[i];
                    if (nx >= 0 && ny >= 0 && ny < 121 && nx < 121
                            && map[ny][nx] != -1) {
                        if (visited[ny][nx]) {
                            continue;
                        }
                        visited[ny][nx] = true;
                        map[ny][nx] = map[y][x] + 1;
                        q.add(new Point(nx, ny));
                    }
                }
            }
            System.out.println(ans);
        }
    }
}

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

#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)(n-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define fi first
#define se second
#define debug(...) {cerr<<"[L"<<__LINE__<<"] "; _debug(__VA_ARGS__);}

template<typename T>
string join(const vector<T>&v, string del=", "){ stringstream s;
    for(auto x : v) s << del << x; return s.str().substr(del.size());
}
template<typename T>
ostream& operator<<(ostream& o, const vector<T>&v){
    if(v.size()) o << "[" << join(v) << "]"; return o;
}
template<typename T>
ostream& operator<<(ostream& o, const vector<vector<T> >&vv){
    int l = vv.size();
    if(l){ o<<endl; rep(i,l) o << (i==0 ? "[ " : ",\n  " ) << vv[i] << (i==l-1 ? " ]" : ""); }
    return o;
}
inline void _debug(){cerr<<endl;}
template<class First, class... Rest>
void _debug(const First& first, const Rest&... rest){cerr<<first<<" ";_debug(rest...);}

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

const double PI = (1*acos(0.0));
const double EPS = 1e-9;
const int INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const ll mod = 1e9 + 7;

inline void finput(string filename) {
    freopen(filename.c_str(), "r", stdin);
}

vi g[100010];
int main(){
    ios_base::sync_with_stdio(0);
    // finput("./input");
    int n, m; cin >> n >> m;
    vl h(n);
    rep(i,n) cin >> h[i];
    rep(i,m){
        int a, b; cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    vi ans(n);
    rep(i,n){
        ans[i] = 1;
        for(auto v : g[i]){
            if(h[i] <= h[v]){
                ans[i] = 0;
                break;
            }
        }
    }
    cout << accumulate(all(ans), 0) << endl;
    return 0;
}

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

int  main()
{
	int n; cin >> n;
	vector<int> v(n);
	rep (i,n)
		cin >> v[i];
	vector<int> c(n);
	rep(i, n)
		cin >> c[i];
	int sum = 0;
	rep(i,n)
	{
		if (v[i] - c[i] > 0)
			sum += v[i] - c[i];
	}
	cout << sum << 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 n = sc.nextInt();
		int answer = 0;
		for(int i = 3;i <=n;i+=2) {
			if(isYakusuEight(i)) {
				answer++;
			}
		}
		System.out.println(answer);
 
	}
 
	private static boolean isYakusuEight(int number) {
		int yakusu = 0;
		for(int i =1; i <=number;i++) {
			if(number % i ==0) {
				yakusu++;
			}
		}
 
		if(yakusu ==8) {
			return true;
		}
		return false;
	}
}

Measured memory_bytes: 21844
import numpy as np
n, m = map(int, input().split())


#card_list = np.zeros(n)

under = 1
top = n

for i in range(m):
    l, r = map(int, input().split())
    if under < l:
        under = l
    if top > r:
        top = r

#print(under, top)
if top-under+1 < 0:
    print(0)
else:
    print(top-under+1)




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

int gcd(int a, int b) {
    if (a < b) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a % b);
}

int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }
    vector<int> l(N), r(N);
    l[0] = a[0], r[N - 1] = a[N - 1];
    for (int i = 1; i < N; i++) {
        l[i] = gcd(a[i], l[i - 1]);
        int j = (N - 1) - i;
        r[j] = gcd(a[j], r[j + 1]);
    }
    vector<int> v(N);
    v[0] = r[1], v[N - 1] = l[N - 2];
    for (int i = 1; i < N - 1; i++) {
        v[i] = gcd(l[i - 1], r[i + 1]);
    }
    int ans = 1;
    for (int i = 0; i < N; i++) {
        ans = max(ans, v[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;

int main(){
  int N,K;
  string S;
  string ans;
  cin >> N >> S >> K;
  for(int i=0;i<N;i++){
    if(S[i] != S[K-1]){
      S[i] = '*';
    }
  }
  cout << S << endl;
}

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

int main() {
  
  vector<char> alph = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'w', 'x', 'y', 'z'};
  
  char C;
  cin >> C;
  
  for (int i = 0; i < 26; i++) {
    if (C != alph[i]) continue;
    else cout << alph[i + 1] << endl;
  }
  
}

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

int main() {
    long long N, A[2] = {2, 1};
    scanf("%lld", &N);
    while (--N) A[1] += A[0], A[0] = A[1] - A[0];
    printf("%lld\n", A[1]);
    return 0;
}


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

long long x, y;

int main () {
	ios_base::sync_with_stdio(false);
	cin>>x>>y;
	
	for(long long i=0; true; i++){
		if(x>y){
			cout<<i<<endl;
			break;
		}
		else x*=2;
	}
}

Measured memory_bytes: 3592
import java.util.*;

public class Main{
	public static void main(String arg[]){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int r=sc.nextInt();
		if(n>=10)
			System.out.println(r);
		else
			System.out.println(r+(100*(10-n)));
	}
}

Measured memory_bytes: 19924
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] ags) {
		Scanner sc = new Scanner(System.in);
		ArrayList<String> list = new ArrayList<>
		(Arrays.asList("a","b","c","d","e","f","g"
				,"h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"));
		String str = sc.next();
		int n = list.indexOf(str);
		System.out.println(list.get(n+1));
	}
}

Measured memory_bytes: 21332
#include <bits/stdc++.h>
#define REP(i,N) for (int i =0; i < (N); ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

int main(){
  int N;
  cin>>N;
  vector<double> A(N);
  REP(i,N){cin>>A.at(i);}
  double Ans;
  REP(i,N){Ans = Ans +1/A[i];}
  Ans = 1/Ans;
  cout << Ans <<endl;
}


Measured memory_bytes: 256
import fractions

def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft



def main():
    a,b,c,d=map(int, input().split())
    x0 = b // c - (a-1) // c
    x1 = b // d - (a-1) // d
    tmp = c*d//fractions.gcd(c, d)
    x2 = b // tmp - (a-1) // tmp
    print(b-a+1-x0-x1+x2)
main()

Measured memory_bytes: 5204
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <string>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
  int n; cin>>n;
	cout << (int)pow((int)pow(n,0.5),2) << endl;
  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int N;
main(){
  cin>>N;
  int a[N],min_list[N],i,total=0;
  double ave,min=100,difference;
  for(i=0;i<N;i++){
    cin>>a[i];
    total+=a[i];
  }
  ave=(double)total/N;
  for(i=0;i<N;i++){
    difference=abs(ave-a[i]);
    if(difference<min)min=difference;
  }
  for(i=0;i<N;i++){
    if(abs(ave-a[i])==min){
      cout<<i<<endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using llong = long long;

const int INF = 100100100;
const int MOD = 1e9 + 7;

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

    int N;
    string S;
    cin >> N >> S;

    vector<vector<int>> exist(20);

    for (int i = 0; i < N; i++) {
        int now = S[i] - '0';
        exist[now].push_back(i);
    }

    int ans = 0;
    for (int i = 0; i < 1000; i++) {
        int first = i / 100;
        int second = (i % 100) / 10;
        int third = i % 10;
        if (exist[first].size() == 0) {
            continue;
        }
        int first_index = exist[first].front();
        int second_index;
        int find;
        find = 0;
        for (auto tmp : exist[second]) {
            if (tmp > first_index) {
                second_index = tmp;
                find = 1;
                break;
            }
        }

        //
        if (find == 0) {
            continue;
        }
        int third_index;
        find = 0;
        for (auto tmp : exist[third]) {
            if (tmp > second_index) {
                third_index = tmp;
                find = 1;
                break;
            }
        }

        if (find == 0) {
            continue;
        }
        ans++;
    }

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


Measured memory_bytes: 512
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func f(a, b int) int {
	// 偶数、奇数の並びは xorすると１となる性質を使う
	n := b - a + 1
	ans := 0
	if a%2 == 1 { // 手前に偶数がない場合
		ans ^= a
		a++
		n--
	}
	d := n / 2
	if b%2 == 0 { // 次に偶数が続かないなら
		ans ^= (d % 2) ^ b
	} else {
		ans ^= d % 2
	}
	return ans
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)

	A, B := getInt(), getInt()

	out(f(A, B))
}


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

typedef long long ll;
typedef long double ld;
#define ff first
#define ss second
#define sz(w) (ll) w.size()
#define frx(x,z,y) for(ll x=z;x<y;++x)
#define fr(x,y) frx(x,0,y)
#define inf 9e18+1
// use unique(x) - removec consecutive items, returns vec.begin() + number of items
// for vector: sort(all(vec)); vec.erase(unique(all(vec)), vec.end());
// use iota(all(vec), 0) for filling a vector with 0,1,2...
// use fill(all(vec), 1) for filling a vector with 1,1,1...
// use rotate(vec.begin(), vec.begin() + 1, vec.end()) to rotate a vector | middle arg becomes first
// use merge(all(vec1), all(vec2), vec3.begin()) to merge 2 vectors, use vec3.resize(vec1.size() + vec2.size()) first
// ll pos = partition_point(all(vec), pred) - vec.begin(); bool pred(ll a){return a<3};
// print number in binary -> cout << bitset<20>(n);

int main(){
	ll x;cin>>x;
	ll res=1;
	ll cnt=x;
	while(cnt%360!=0){cnt+=x;++res;}
	cout<<res<<endl;
}


Measured memory_bytes: 3616
n = list(input())
hon = ["2", "4", "5", "7", "9"]
pon = ["0", "1", "6", "8"]
bon = ["3"]
if(n[-1] in hon):
    print("hon")
elif(n[-1] in pon):
    print("pon")
elif(n[-1] in bon):
    print("bon")

Measured memory_bytes: 9108
import bisect


class SqrtSet:
    def __init__(self, block_limit=201):
        self.key = []
        self.child = [[]]
        self.block_limit = block_limit

    def search_lower(self, key):
        if key is None:
            return None
        ret = None
        i = bisect.bisect_left(self.key, key)
        if i != 0:
            ret = self.key[i - 1]
        block = self.child[i]
        i = bisect.bisect_left(block, key)
        if i != 0:
            ret = block[i - 1]
        return ret

    def search_higher(self, key):
        if key is None:
            return None
        ret = None
        i = bisect.bisect_right(self.key, key)
        if i != len(self.key):
            ret = self.key[i]
        block = self.child[i]
        i = bisect.bisect_right(block, key)
        if i != len(block):
            ret = block[i]
        return ret

    def insert(self, key):
        i = bisect.bisect(self.key, key)
        block = self.child[i]
        bisect.insort(block, key)
        if len(block) == self.block_limit:
            sep = self.block_limit // 2
            self.key.insert(i, block[sep])
            self.child.insert(i + 1, block[sep + 1:])
            self.child[i] = block[:sep]

    def dump(self):
        for b in self.child:
            print(len(b), end=" ")
        print("")


def main():
    n = int(input())
    p = list(map(int, input().split()))
    idx = [0] * n
    for i in range(0, n):
        idx[i] = i
    idx.sort(key=lambda i: - p[i])
    t = SqrtSet()
    t.insert(-1)
    t.insert(n)
    ans = 0
    for i in idx:
        nex = t.search_higher(i)
        nexnex = t.search_higher(nex)
        pre = t.search_lower(i)
        prepre = t.search_lower(pre)
        if prepre != None:
            ans += p[i] * (pre - prepre) * (nex - i)
        if nexnex != None:
            ans += p[i] * (i - pre) * (nexnex - nex)
        t.insert(i)
    print(ans)


main()


Measured memory_bytes: 93676
#include <iostream>

#include <queue>
using namespace std;

int main(){

  int n;
  while(1){
    cin >> n;
    if(n == 0) break;

    priority_queue< pair<int,int> > p;
    for(int i=0;i<n;i++){
      int t,d1,d2;
      cin >> t >> d1 >> d2;
      p.push( make_pair((d1+d2),t) );
    }
    cout << p.top().second << " " << p.top().first << "\n";

  }

}

Measured memory_bytes: 1324
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long A = sc.nextLong();
		long B = sc.nextLong();
		long C = sc.nextLong();
		if (A>=B && A>=C) {
			System.out.println(A%2==0?"0":B*C);
		}
		else if (B>=A && B>=C) {
			System.out.println(B%2==0?"0":C*A);
		}
		else {
			System.out.println(C%2==0?"0":A*B);
		}
		sc.close();
	}

}


Measured memory_bytes: 9428
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    unsigned long N;

    cin >> N;
    unsigned long answer = 0;
    unsigned long count = 1;
    
    while ( N > 0 ) {
        if (N == 1) {
            answer += count;
            break;
        }
        answer += count;
        count *= 2;
        N /= 2;
    }
    cout << answer << endl;
    return 0;
}

// GCC reference:
//   https://gcc.gnu.org/

// C++ language references:
//   https://cppreference.com/
//   https://isocpp.org/
//   http://www.open-std.org/jtc1/sc22/wg21/

// Boost libraries references:
//   https://www.boost.org/doc/


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main{
    public static void main(String[] Args) throws IOException{
        final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        final int[] s = new int[2000000];
        int sl = 0;
        final StringBuilder sb = new StringBuilder();
        while(true){
            final String in = br.readLine();
            if(in.charAt(2)=='s'){
                final int val = Integer.parseInt(in.substring(7));
                ++sl;
                int i, j;
                for(i = sl, j = i>>>1; i>1&&s[j]<val; i = j, j >>>= 1){
                    s[i] = s[j];
                }
                s[i] = val;
            }else if(in.charAt(2)=='t'){
                sb.append(s[1]).append('\n');
                final int val = s[sl--];
                int i = 1;
                while(true){
                    int j = i+i;
                    if(j>sl) break;
                    if(j<sl&&s[j]<s[j+1]) j++;
                    if(val>s[j]) break;
                    s[i] = s[j];
                    i = j;
                }
                s[i] = val;
            }else break;
        }
        System.out.print(sb);
    }
}

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

int main() {
    int n;
    cin >> n;
    float x=0;
    for (int i=0; i<n; i++)
    {
        int a;
        cin >> a;
        x += 1/(float)a;
    }
    cout << 1/(float)x;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n; cin >> n;
    vector<pair<int, int>> vec(n);
    for(int i = 0; i < n; i++) {
        int x, y; cin >> x >> y;
        vec[i] = {x, y};
    }

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

    int cnt = 0;
    double total = 0;
    do {
        cnt++;
        pair<int, int> last = vec[0];
        long double dist = 0;
        for(int i = 1; i < vec.size(); i++) {
            dist += sqrt((last.first - vec[i].first) * (last.first - vec[i].first) +
                                 (last.second - vec[i].second) * (last.second - vec[i].second));
            last = vec[i];
        }
        total += dist;
    } while(next_permutation(vec.begin(), vec.end()));

    cout << fixed << setprecision(12) << total / cnt;
}

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

using namespace std;

int a[510][510],c[250250][4];
int h,w;


int main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    cin>>h>>w;
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {
            cin>>a[i][j];
        }
    }
    int ans=0;
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w-1;j++)
        {
            if(a[i][j]%2==1)
            {
                c[ans][0]=i;
                c[ans][1]=j;
                c[ans][2]=i;
                c[ans][3]=j+1;
                ans++;
                a[i][j+1]++;
            }
        }
    }
    for(int i=0;i<h-1;i++)
    {
        if(a[i][w-1]%2==1)
        {
            c[ans][0]=i;
            c[ans][1]=w-1;
            c[ans][2]=i+1;
            c[ans][3]=w-1;
            ans++;
            a[i+1][w-1]++;
        }
    }
    cout<<ans<<endl;
    for(int i=0;i<ans;i++)
    {
        cout << c[i][0] + 1 << " " << c[i][1] + 1 << " " << c[i][2] + 1 << " " << c[i][3] + 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 6912
/***********************************************
 *                                             *
 *   author: raghav_0901 (Raghav Dalmia)       *
 *   updated on: 21-06-2020, 10:35:01 pm IST   *
 *                                             *
\***********************************************/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define int long long int

signed main( )
{
    int n;
    cin >> n;
    vector<int> v(n);
    for (int &i : v) cin >> i;

    int all = 0;

    for (int i = 0; i < n; i += 2) { all = all ^ (v[i] ^ v[(i + 1) % n]); }

    for (int i = 0; i < n; i++) cout << (v[i] ^ all) << " ";
    cout << '\n';
    return 0;
}


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

vector<ll> nums;

bool isCorrect(ll x){
	bool seven,five,three;
	seven = five = three = false;
	while(x){
		if(x%10 == 7)
			seven = true;
		if(x%10 == 5)
			five = true;
		if(x%10 == 3)
			three = true;
		x /= 10;	
	}
	return seven and five and three;
}

void generate(int digits,ll num){
	if(digits == 0){
		if(isCorrect(num))
			nums.push_back(num);	
		return;
	}
	generate(digits-1,num*10+7);
	generate(digits-1,num*10+5);
	generate(digits-1,num*10+3);
}

int main(){
	for(int i=3;i<=10;i++)
		generate(i,0);
	sort(nums.begin(),nums.end());

	ll N;
	cin>>N;
	cout<<distance(nums.begin(),upper_bound(nums.begin(),nums.end(),N))<<"\n";
	return 0;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
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; }
int main(){
    ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    vector<int> k(m), p(m);
    vector<vector<int>> s(m);
    rep(i, m) {
        cin >> k[i];
        s[i].resize(k[i]);
        rep(j,k[i]) {cin >> s[i][j];s[i][j]--;}
    }
    rep(i,m) cin >> p[i];
    int cnt = 0;
    rep(bits,1<<n) {
        bool all_on_flag = true;
        rep(i,m) {
            int mask = 0;
            rep(j,k[i]) mask+=1<<s[i][j];
            int num_on_bits = bits&mask;
            int num_on=0;
            rep(j,n) if((num_on_bits>>j)&1) num_on++;
            if(num_on%2 != p[i]) {all_on_flag = false;break;}
        }
        if(all_on_flag) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char a[101];
	gets(a);
	for(int i=0;i<strlen(a);i++)
	{
	
	if(a[i]=='C')
	{
	for(int j=i;j<strlen(a);j++)
    {
	if(a[j]=='F')
	{
	cout<<"Yes";
	return 0;
	}
	}
  
  	}
	
	}
    cout<<"No";
	return 0;
} 

Measured memory_bytes: 256
import java.util.*;
	import java.util.Map.Entry;
	 
	 
	 class Main {
		 static int mod =  (int) (Math.pow(10,9)+7);
//		 static int mod =  (int) 998244353;
		 static List<ArrayList<Integer>> list= new ArrayList<ArrayList<Integer>>();
		 static int a_dist[];
		 public static void main(String[] args) {
	    	
	        Scanner sc = new Scanner(System.in);
	        int max = 2*100005;
	        int N = sc.nextInt();	
	        if(N>=30) {
	        	System.out.println("Yes");
	        }else {
	        	System.out.println("No");
	        }
	        
		 }
		 
	}

Measured memory_bytes: 35760
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        boolean[][] cards = new boolean[4][13]; //false
        //[0]:S, [1]:H, [2]:C, [3]:D
        for (int i=0; i<n; i++){
            String[] ln = br.readLine().split(" ");
            String pic = ln[0];
            int num = Integer.parseInt(ln[1]) - 1;
            if ("S".equals(pic)){
                cards[0][num] = true;
            }else if ("H".equals(pic)){
                cards[1][num] = true;
            }else if ("C".equals(pic)){
                cards[2][num] = true;
            }else{
                cards[3][num] = true;
            }
        }
        for (int j=0; j<4; j++){
            for (int k=0; k<13; k++){
                if (!cards[j][k]){
                    switch (j){
                    case 0:
                        System.out.print("S ");
                        System.out.println(k+1);
                        continue;
                    case 1:
                        System.out.print("H ");
                        System.out.println(k+1);
                        continue;
                    case 2:
                        System.out.print("C ");
                        System.out.println(k+1);
                        continue;
                    case 3:
                        System.out.print("D ");
                        System.out.println(k+1);
                        continue;
                    }
                }
            }
        }
    }
}

Measured memory_bytes: 16940
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int l = sc.nextInt();
		int nuku = 0;
		if (l >= 0) {
			nuku = 0;
		} else if (l < 0 && l + n - 1 > 0) {
			nuku = -1;
		} else {
			nuku = n - 1;
		}
		int ret = 0;
		for (int i = 1; i <= n; i++) {
			if (i == nuku + 1) {
				continue;
			}
			ret += l + i - 1;
		}
		System.out.println(ret);
	}
}


Measured memory_bytes: 21844
package main

import "fmt"

func isOdd(n int) bool { return n%2 != 0 }

func strCountAlphabets(s string) [26]int {
	ct := [26]int{}
	for _, ss := range s {
		ct[ss-'a']++
	}
	return ct
}

func main() {
	var h, w int
	fmt.Scan(&h, &w)
	a := ""
	for i := 0; i < h; i++ {
		var ai string
		fmt.Scan(&ai)
		a += ai
	}

	alphas := strCountAlphabets(a)

	ct4, ct2, ct1 := 0, 0, 0
	for _, x := range alphas {
		ct4 += x / 4
		x %= 4
		ct2 += x / 2
		x %= 2
		ct1 += x
	}

	check := func() bool {
		if isOdd(h) && isOdd(w) {
			if h == 1 {
				return ct1 <= 1 && ct2*2 <= w-1
			} else if w == 1 {
				return ct1 <= 1 && ct2*2 <= h-1
			}
			return ct1 <= 1 && ct2*2 <= w+h-1
		} else if isOdd(h) {
			return ct1 == 0 && ct2*2 <= w
		} else if isOdd(w) {
			return ct1 == 0 && ct2*2 <= h
		} else {
			return ct4*4 == w*h
		}
	}

	if check() {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


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

typedef struct _point {
	double x, y;
} point;

point walk(int r, int d) {
	int d2 = (d + 360*10000) % 360;
	point p;
	if(d2 == 0) {
		p.x = r;
		p.y = 0;
		return p;
	} else if(d2 == 90) {
		p.x = 0;
		p.y = r;
		return p;
	} else if(d2 == 180) {
		p.x = -r;
		p.y = 0;
		return p;
	} else if(d2 == 270) {
		p.x = 0;
		p.y = -r;
		return p;
	} else if(0 < d2 && d2 < 90) {
		p.x = r * fabs(cos(d2 * M_PI / 180));
		p.y = r * fabs(sin(d2 * M_PI / 180));
		return p;
	} else if(90 < d2 && d2 < 180) {
		p.x = -r * fabs(cos((180-d2) * M_PI / 180));
		p.y = r * fabs(sin((180-d2) * M_PI / 180));
		return p;
	} else if(180 < d2 && d2 < 270) {
		p.x = -r * fabs(cos((d2-180) * M_PI / 180));
		p.y = -r * fabs(sin((d2-180) * M_PI / 180));
		return p;
	} else {
		p.x = r * fabs(cos((360-d2) * M_PI / 180));
		p.y = -r * fabs(sin((360-d2) * M_PI / 180));
		return p;
	}
}

int main(void) {
	int angle = 90+36000;
	int r, d;
	char c;
	double x = 0.0;
	double y = 0.0;
	point p;
	
	while(scanf("%d%c%d\n", &r, &c, &d)==3) {
		if(r == 0 && d == 0) break;
		
//		angle -= d;
		p = walk(r, angle);
//		printf("%lf %lf %d %d %d\n", p.x, p.y, r, d, angle%360);
		x = x + p.x;
		y = y + p.y;
		angle -= d;
	}
	
	printf("%d\n%d\n", (int)x, (int)y);
	
	return 0;
}

Measured memory_bytes: 608
#include<stdio.h>
int main()
{
	int a[3][3],n,b[10];
	int i,j,k,x[3][3]={0},f=0;
	for(i=0;i<3;i++){
		for(j=0;j<3;j++){
			scanf("%d",&a[i][j]);
		}
	}
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&b[i]);
	}
	for(i=0;i<3;i++){
		for(j=0;j<3;j++){
			for(k=0;k<n;k++){
				if(a[i][j]==b[k]){
					x[i][j]=1;
				}
			}
		}
	}
	for(i=0;i<3;i++){
		if(x[0][i]==1&&x[0][i]==x[1][i]&&x[2][i]==x[0][i]){
			f=1;
		}
		if(x[i][0]==1&&x[i][0]==x[i][1]&&x[i][2]==x[i][0]){
			f=1;
		}
	}
	if(x[0][0]==1&&x[0][0]==x[1][1]&&x[0][0]==x[2][2]){
		f=1;
	}
	if(x[0][2]==1&&x[0][2]==x[1][1]&&x[0][2]==x[2][0]){
		f=1;
	}
	if(f==1){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 1644
//INCLUDE
//------------------------------------------
#include <iostream>
#include <functional>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <string>
#include <cstring>
#include <vector>
//DEFINE
//------------------------------------------
#define ll long long
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
using namespace std;
//-------------------------------------------

int main(void){
    ll x,y;while(cin>>x>>y){
        if(!x&&!y)break;
        if(x<y)cout<<x<<" "<<y;
        else cout<<y<<" "<<x;
        cout<<endl;
    }
  return 0;
}



Measured memory_bytes: 3112
#include<iostream>
#include<string>
using namespace std;
int main() {
  string s;
  std::cin >> s;
  if(s=="Sunny")std::cout << "Cloudy" << '\n';
  else if(s=="Cloudy")std::cout << "Rainy" << '\n';
  else std::cout << "Sunny" << '\n';
  return 0;
}


Measured memory_bytes: 256