akhauriyash/Code-Regression huggingface dataset:
class Sprinkler
  def initialize(index, x, y)
    @index = index
    @x = x
    @y = y
  end

  def in_range?(x, y)
    diff_x = (@x - x).abs
    diff_y = (@y - y).abs
    diff_x <= 1 && diff_y <= 1
  end
end

def movable_point(x, y)
  return [[x-1, y+2], [x, y+2], [x+1, y+2],
          [x+2, y+1], [x+2, y], [x+2, y-1],
          [x+1, y-2], [x, y-2], [x-1, y-2],
          [x-2, y-1], [x-2, y], [x-2, y+1]]
end

def calc
  l = gets.chomp
  exit if l == "0 0"

  # initial position
  init = l.split(" ").map {|x| x.to_i}

  # num of sprinkler
  n = gets.chomp.to_i

  # sprinkler position
  pos = gets.split(" ").map {|x| x.to_i}
  sprinklers = Array.new
  n.times do |i|
    sprinkler = Sprinkler.new(i, pos[2*i], pos[2*i+1] )
    sprinklers.push sprinkler
  end

  path = Array.new
  path.push init

  nextPath = Array.new
  # ??????????????????????????°?????°?????????
  for sprinkler in sprinklers do
    # ???????????§?????°??????????????§?¨?
    path.each do |point|
      # ?????¨??°??????????§???????????????§?¨?
      movable_point(point[0], point[1]).each do |movable|
        nextPath.push movable if sprinkler.in_range? movable[0], movable[1]
      end
    end
    if nextPath.length == 0 then
      puts "NA"
      return
    end
    path = nextPath.clone
    nextPath.clear
  end
  puts "OK"
  return
end

# input
while true do
  calc
end

Measured memory_bytes: 8816
/*In the name of ALLAH, Most Gracious, Most Merciful*/
#include<bits/stdc++.h>

#define ll                      long long int
#define ull                     unsigned long long int
#define PI                      2*acos(0.0)
#define sqr(x)                  (x)*(x)
#define EPS                     10E-10
#define MOD                     1000000007
#define longlimit               92233720368547758
#define infinity                (1<<28)
#define setbits                 __builtin_popcount
#define zerobits                __builtin_ctzll
#define parity(n)               __builtin_parity(n)
#define pb(a)                   emplace_back(a)
#define mp                      make_pair
#define ff                      first
#define ss                      second
#define gcd(a, b)               __gcd(a,b)
#define lcm(a, b)               ((a)*(b))/gcd(a,b)
#define watch(x)                cout << (#x) << " is " << (x) << endl
#define TEST_CASES()            ll t;cin>>t;while (t--)
#define PRECISION(a,x)          fixed<<setprecision(x)<<a<<endl;
#define endl                    "\n"
#define all(a)                  (a.begin()),(a.end())
#define UNIQUE(X)               (X).erase(unique(all(X)),(X).end())
#define DELETE(X)               (X).erase (remove (all(X)),(X).end())
#define SORT_UNIQUE(c)          (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define FAST_IO()               ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define FILE_IO()               freopen("output.txt", "w", stdout);freopen("input.txt", "r", stdin)
using namespace std;


void solve()
{
    ll a,b;
    cin>>a>>b;
    cout<<a*b<<endl;
    
}

int32_t main()
{
    FAST_IO();
    //TEST_CASES()
        solve();
}




Measured memory_bytes: 3592
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;

int main() {
    string s;
    ll k;
    cin >> s;
    cin >> k;
    for (int i = 0; i < k; i++) {
        if (s[i] != '1') {
            cout << s[i] << endl;
            return 0;
        }
    }
    cout << 1 << endl;
}


Measured memory_bytes: 256
//
// Created by watemus on 05.06.2020.
//

#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>

using namespace std;

#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define ff first
#define ss second

using ll = long long;
using ld = long double;

template<typename T>
using vec = vector<T>;

template<typename T>
using uset = unordered_set<T>;

template<typename T1, typename T2>
using umap = unordered_map<T1, T2>;

#define int ll

constexpr ll INFL = 1'000'000'000'000'000'228;
constexpr int INFI = 1'000'000'228;
constexpr ld PI = acos(-1);

vector<pair<int, int>> DD = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};

#ifdef LOCAL
#else
#endif

void run() {
    int a, b, b2;
    char ch;
    cin >> a >> b >> ch >> b2;
    cout << int(a * (b * 100 + b2) / 100LL) << '\n';
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
*/

signed main() {
#ifdef LOCAL
    std::freopen("input.txt", "r", stdin);
#else
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
#endif
    cout << fixed << setprecision(20);
    int t = 1;
//    cin >> t;
    while (t--) {
        run();
    }
    return 0;
}



Measured memory_bytes: 3652
N, M = map(int, input().split())
minNum = 1
maxNum = N
for lr in range(M):
  l, r = map(int, input().split())
  if minNum <= l and r <= maxNum:
    minNum = l
    maxNum = r
  elif minNum <= l <= maxNum and maxNum <= r:
    minNum = l
  elif l <= minNum and minNum <= r <= maxNum:
    maxNum = r
  elif r < minNum or maxNum < l:
    print("0")
    exit()
#  print(l,r,minNum,maxNum)
print(maxNum - minNum +1)


Measured memory_bytes: 3064
n, m = map(int, input().split())
dat = []
dat_m = [[]] * (n+1)
dat_finish = [False] * (n+1)

for i in range(m):
    a,b = map(int, input().split())
    dat.append( (a,b) )

#print(dat)
for i in range(m):
    a,b = dat[i]
    if b == n:
        dat_finish[a] = True
#print(dat_finish)

c = False
for i in range(m):
    a,b = dat[i]
    if a == 1:
        if dat_finish[b]:
            c = True

print("POSSIBLE" if c else "IMPOSSIBLE")

Measured memory_bytes: 66776
import math

# print('input >>')
N = int(input())

floorNsqrt = int(math.sqrt(N))

i = 0
while i <= floorNsqrt:
    i += 1
    if N % i == 0:
        N_a = i

N_b = N / N_a
ans = int(N_a-1 + N_b-1)

# print('----------output----------')
print(ans)

Measured memory_bytes: 3060
n,m=map(int,input().split())
py=[]
for i in range(m):
    q=[int(j) for j in input().split()]
    py.append(q+[i])
from operator import itemgetter
py.sort(key=itemgetter(1))
py.sort(key=itemgetter(0))
ans=[]
q=0
c=2
for i,j,k in py:
    p=str(i).rjust(6,'0')
    if q==i:
        y=str(c).rjust(6,'0')
        c+=1
    else:
        y="000001"
        q=i
        c=2   
    ans.append([p+y,k])
from operator import itemgetter
ans.sort(key=itemgetter(1))
for i,j in ans:
    print(i)







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

using namespace std;
typedef long long nagai;

const nagai mod = 1000000007;

void md(nagai& x)
{
	if (x >= mod)
		x -= mod;
}

int main()
{
	int n; 
	cin >> n;
	vector<nagai> cnt(n + 1);
	cnt[0] = 1;
	cnt[1] = n;
	nagai cursum = 0;
	for (int i = 2; i <= n; ++i)
	{
		md(cnt[i] += cnt[i - 1]);
		(cnt[i] += 1LL * (n - 2 + 1) * (n - 1)) %= mod;
		int cnt0 = (n - 2 + 1) - (i - 3 - 0 + 1);
		md(cnt[i] += cnt0);
		md(cnt[i] += cursum);
		md(cursum += cnt[i - 2]);
		//for (int k = 2; k <= n; ++k)
			//md(cnt[i] += cnt[max(0, i - k - 1)]);
		//cerr << cnt[i] << ' ';
	}
	//cerr << endl;
	cout << cnt.back() << endl;

}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep1(i,n) for (int i = 1; i <= n; ++i)
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
const long long MOD = 1e9+7;
template<typename T> inline void add(T& a, T b) { a += b; if (a >= MOD) a -= MOD; }

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

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

  int ans = 0;
  while(n) {
    ++ans;
    n /= k;
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      String S = sc.next();
      String T = sc.next();
      int A = sc.nextInt();
      int B = sc.nextInt();
      String U = sc.next();
      if(S.equals(U)){
        System.out.println((A-1) +" "+ B);
      }else if(T.equals(U)){
        System.out.println(A + " " + (B-1));
      }
    }
}

Measured memory_bytes: 38484
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#define r(i,n) for(int i=0; i<n; i++)
typedef long long ll;
using namespace std;

int main(void){
  int n=3;
  int c[4][4]={};
  int d[4][4]={};
  int e[4][4]={};
  r(i,n){
    r(j,n){
      cin >> c[i][j];
    }
  }

  r(i,n){
    r(j,n){
      d[i][j]=c[i][j]-c[i][j+1];
    }
    d[i][2]=c[i][2]-c[i][0];
  }

  r(j,n){
    r(i,n){
      e[i][j]=c[i][j]-c[i+1][j];
    }
      e[2][j]=c[2][j]-c[2][j];
  }

  r(i,n){
    if(d[0][i]!=d[1][i] || d[1][i]!=d[2][i]){
      cout << "No" << endl;return 0;
    }
  }
  r(i,n){
    if(e[i][0]!=e[i][1] || e[i][1]!=e[i][2]){
      cout << "No" << endl;return 0;
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 256
//package abc167.C

import java.io.*
import java.math.*
import java.util.*
import kotlin.math.*

var reader: BufferedReader = System.`in`.bufferedReader()
var writer: PrintWriter = PrintWriter(System.`out`)

fun next() = reader.readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextStrings() = next().split(" ")
fun nextInts() = nextStrings().map { it.toInt() }
fun nextLongs() = nextStrings().map { it.toLong() }
fun nextDoubles() = nextStrings().map { it.toDouble() }

fun put(v: Any?) = writer.print(v)
fun puts() = writer.println()
fun puts(v: Any?) = writer.println(v)

var debug = false
fun dp(v: Any?) {
    if (debug) println(v)
}
fun dp() {
    if (debug) println()
}

fun test(case: Int, input: String, expected: String) {
    reader = input.trimIndent().reader().buffered()

    val stringWriter = StringWriter()
    writer = PrintWriter(stringWriter)

    solve()
    writer.flush()

    val actual = stringWriter.toString()

    println("[test $case]")
    if ("${expected}" == actual) {
        println("OK")
    } else {
        println("NG")
        println()
        println("expected: \"${expected}\"")
        println("actual:   \"${actual}\"")
    }
    println()
}

fun main(args: Array<String>) {
    if ((args.size == 1) && (args[0] == "test")) {
        testAll()
    } else {
        solve()
        writer.flush()
    }
}

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

fun testAll() {
    debug = true

    test(1,
    """
    3 3 10
    60 2 2 4
    70 8 7 9
    50 2 3 9
    """,
    "120")
    test(2,
    """
    3 3 10
    100 3 1 4
    100 1 5 9
    100 2 6 5
    """,
    "-1")
    test(3,
    """
    8 5 22
    100 3 7 5 3 1
    164 4 5 2 7 8
    334 7 2 7 2 9
    234 4 7 2 8 2
    541 5 4 3 3 6
    235 4 8 6 9 7
    394 3 6 1 6 2
    872 8 4 3 7 2
    """,
    "1067")
}

typealias Book = Pair<Int, List<Int>>

fun buy(X: Int, books: List<Book>, skills: Array<Int>, cost: Int, idx: Int): Int {
    if (idx >= books.size) return Int.MAX_VALUE

    val withoutBookCost = buy(X, books, skills, cost, idx+1)

    val book = books[idx]

    var withBookCost = cost + book.first

    val withBookSkills = skills.copyOf()
    book.second.forEachIndexed { i, skill ->
        withBookSkills[i] += skill
    }

    if (withBookSkills.any { it < X }) {
        withBookCost = buy(X, books, withBookSkills, withBookCost, idx+1)
    }

    return min(withoutBookCost, withBookCost)
}

fun solve() {
    val (N, M, X) = nextInts()

    val books = mutableListOf<Book>()
    repeat(N) {
        val lines = nextInts().toMutableList()
        val C = lines.first()
        books.add(Book(C, lines.subList(1, M+1)))
    }
    books.sortBy { it.first }

    val skills = Array<Int>(M) { 0 }
    val cost = buy(X, books, skills, 0, 0)

    if (cost != Int.MAX_VALUE) {
        put(cost)
    } else {
        put(-1)
    }
}


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

int main() {
  int k;
  cin >> k;
  int ans = 0;
  for (int i = 0; i < k; i++) {
    ans = (ans * 10 + 7) % k;
    if (ans == 0) {
      cout << i + 1 << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 3644
def INT():
    return int(input())

def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

N = INT()
a = LI()

x = a[0]
y = sum(a) - x

ans = abs(x - y)

for i in range(1, N - 1):
    x += a[i]
    y -= a[i]
    ans = min(ans, abs(x - y))
    
print(ans)

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


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli n,temp1,temp2,t,x,y,m,k,a,b,c,M=1e6;
	
		cin>>x>>y;
		
		if(y >4*x|| y<2*x || y%2==1)
		{
			cout<<"No";
		}
		else
		{
			cout<<"Yes";
		}
	
	
}

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

int main(){
	vector<int> a(3), ans(4, 0);
	while( cin >> a[0] >> a[1] >> a[2] ){
		sort(a.begin(), a.end());
		double cosX = (double) (a[0] * a[0] + a[1] * a[1] - a[2] * a[2]) / 2.0 * a[0] * a[1];
		 
		if( a[0] + a[1] <= a[2] ){ // 三角形でない
			cout << ans[0] << " " << ans[1] << " " << ans[2] << " " << ans[3] << endl;
			return 0;
		}else if( a[0] * a[0] + a[1] * a[1] == a[2] * a[2] ){ // 直角三角形
			ans[1]++;
		}else if( cosX <= 0 ){ // 鈍角三角形
			ans[3]++;
		}else{ // 鋭角三角形
			ans[2]++;
		}
		ans[0]++;
	}
}

Measured memory_bytes: 1216
H, N = map(int, input().split())
A = [int(x) for x in input().split()]
list2 = sorted(A, reverse=True)  # reverseをTrueに

if N>H:
    print(0)
elif N>0:
    del list2[0:N]
    print(sum(list2))
elif N<=0:
    print(sum(A))

Measured memory_bytes: 26180
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <cctype>
#include <fstream>
#include <cstring>
#include <unordered_map>

using namespace std;

#define ll long long
#define MOD 1000000007
#define INF 2000000000
#define LINF 9000000000000000000
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define du(x) cout<<#x<<'='<<x<<endl
#define du2(x,y) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<'\n'<<endl
#define du3(x,y,z) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<' '<<#z<<'='<<z<<'\n'<<endl
#define darr(arr,n) rep(i,(n-arr)){cout<<*(arr+i)<<' ';}cout<<endl
#define ddarr(arr,a,b) rep(i,a){rep(j,b){cout<<*(arr+i*b+j)<<' ';}cout<<endl;}
#define ddd ifstream in("Text.txt");cin.rdbuf(in.rdbuf());


int main() {
    ll r, D, x;
    cin >> r >> D >> x;

    ll ans = x;
    rep(i, 10) {
        x = x * r - D;
        cout << x << endl;
    }
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) throws IOException {
		new Main().solve();
	}

	private void solve() throws IOException {
		try {
			solveA();
			//			 solveB();
			//			 solveC();
			//			 solveD();
			//			 solveE();
			//			 solveF();
		} finally {
			if (in != null) {
				in.close();
			}
			if (out != null) {
				out.flush();
				out.close();
			}
		}

	}

	private void solveA() {
		int numN = nextInt();
		int numA = nextInt();

		out.println(numN * numN - numA);
	}

	private void solveB() {
		int numN = nextInt();

		out.println("");
	}

	private void solveC() {
		int numN = nextInt();

		out.println("");
	}

	private void solveD() {
		int numN = nextInt();

		out.println("");
	}

	private void solveE() {
		int numN = nextInt();

		out.println("");
	}

	private void solveF() {
		int numN = nextInt();

		out.println("");
	}

	private final PrintWriter out = new PrintWriter(System.out);
	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;
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

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

Measured memory_bytes: 21076
#include <stdio.h>

int main ()
{
	long long int n;
	scanf("%lld", &n);
	
	long long int sum = 0;
	
	for(int i=0; i<=n; i++)
	{
	
		if(i%3==0 || i%5==0) // fizz
		{
			continue;
		} 
		
		else //buzz
		{
			sum = sum + i;
		}
	}	
	
	printf("%lld", sum);
	
	return 0;
}

Measured memory_bytes: 1736
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <functional>
#include <complex>
#include <stack>
#include <tuple>
#include <array>
using namespace std;
#define rep(i,n) for (int i=0; i < (n); i++)


typedef long long int ll;
typedef double D;      // ??§?¨?????????????double???long double?????????
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
typedef vector<P> VP;


const int INF = (1<<30) - 1;
const D EPS = 1e-9;

#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)

enum Color{WHITE, BLACK, NONE};

int n, m, p;

inline bool in_field(int x, int y, int z){
    return 0<=x&&x<n && 0<=y&&y<n && 0<=z&&z<n;
}

bool win(vector<vector<vector<Color>>> field, int x, int y, int z){
    Color color = field[x][y][z];
    
    for(int dx=-1; dx<=1; dx++){
        for(int dy=-1; dy<=1; dy++){
            for(int dz=-1; dz<=1; dz++) if(dx|dy|dz){
                int nx, ny, nz;
                int s = 0, t = 0;
                while(nx=x+dx*s, ny=y+dy*s, nz=z+dz*s, in_field(nx, ny, nz) && field[nx][ny][nz]==color) s--;
                while(nx=x+dx*t, ny=y+dy*t, nz=z+dz*t, in_field(nx, ny, nz) && field[nx][ny][nz]==color) t++;
                
                if(m <= t - s - 1)
                    return true;
            }
        }
    }
    
    return false;
}

void solve(){
    vector<vector<vector<Color>>> field(n, vector<vector<Color>>(n, vector<Color>(n, NONE)));
    vector<vector<int>> top(n, vector<int>(n, 0));

    vector<P> commands(p);
    for(int i=0; i<p; i++){
        int x, y; cin >> x >> y;
        x--; y--;
        commands[i] = P(x, y);
    }
    
    for(int i=0; i<p; i++){
        int x, y;
        x = commands[i].X;
        y = commands[i].Y;
        
        Color color = (i%2 == 0? BLACK: WHITE);
        field[x][y][top[x][y]] = color;
        top[x][y]++;
        
        if(win(field, x, y, top[x][y]-1)){
            cout << (color == BLACK? "Black": "White") << " " << i+1 << endl;
            return;
        }
    }
    
    cout << "Draw" << endl;
}

//g++ -std=c++0x -msse4.2 -O3
//#include <bits/stdc++.h>
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    //cout.precision(16);
    
    while(cin>>n>>m>>p, n|m|p){
        solve();
    }
    
    return 0;
}

Measured memory_bytes: 1240
n = gets.to_i
ss = []
tt = []

n.times{
	s, t = gets.split
	ss << s
	tt << t.to_i
}

x = gets.chomp

index = ss.index(x)

result = tt[(index + 1) .. -1].inject(:+)

if result == nil then
	puts 0
else
	puts result
end


Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define pb push_back
#define FOR(i, a, b) for (long long i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define MOD 1000000007
#define INF 93193111451418101
#define MIN -93193111451418101
#define EPS 1e-11
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
using namespace std;

int main() {
  ll a, b, c;
  cin >> a >> b >> c;
  ll cnt = 3 * max({a, b, c});
  while (1) {
    if ((cnt - (a + b + c)) % 2 == 0)
      return !printf("%lld\n", ((cnt - (a + b + c)) / 2));
    cnt += 3;
  }
}


Measured memory_bytes: 256
N, M = map(int, input().split())

if N >= 3 and M >= 3:
  print(N*M - (2*N + 2*M - 4))
elif N == 2 or M == 2:
  print(0)
elif N == 1 and M == 1:
  print(1)
elif N == 1:
  print(M - 2)
elif M == 1:
  print(N - 2)
else:
  print(1)


Measured memory_bytes: 2940
import java.io.InputStreamReader
import java.io.BufferedReader
import java.io.PrintWriter

fun main(args: Array<String>) {
  val br = BufferedReader(InputStreamReader(System.`in`))
  val out = PrintWriter(System.`out`)

  val n = br.readLine().toInt()
  val d = (1..n-1).map {
    br.readLine().split(" ").map { it.toInt() }.toIntArray()
  }

  tailrec fun rec(acc: Int, i:Int):Int =
    if(i == n-1) acc
    else {
      val(c, s, f) = d[i]
      when {
        acc <= s -> rec(s + c, i + 1)
        (s+acc) % f == 0 -> rec(acc + c, i + 1)
        else -> rec(acc + f -((acc - s) % f) + c, i + 1)
      }
    }

  for(i in 0..d.lastIndex) {
    out.println(rec(0, i))
  }
  out.println(0)
  out.flush()
}

Measured memory_bytes: 37796
#include<stdio.h>

int main(void)
{
  int ball[100] = {0};
  int i;//for loop
  int n = 0, k = 0;
  int sum = 0;

  scanf("%d", &n);
  scanf("%d", &k);
  for(i=0; i<n; i++){
    scanf("%d", &ball[i]);
  }
//片道で考える
  for(i=0; i<n; i++){
    if(k-ball[i] >= ball[i]){
      sum += ball[i];
    }else{
      sum += k-ball[i];
    }
  }

  printf("%d\n", sum * 2);

  return 0;
}


Measured memory_bytes: 128
const int LG = 21;
const int FN = 400005;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
const long long INFLL = 1e18;

#include <bits/stdc++.h>

const double PI = acos(-1);

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int> > G;

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second
#define re return
#define pb push_back
#define uniq(x) sort(all(x)); (x).resize(unique(all(x)) - (x).begin())

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

int cx[4] = {-1, 0, 1, 0};
int cy[4] = {0, -1, 0, 1};
string Yes[2] = {"No", "Yes"};
string YES[2] = {"NO", "YES"};
string Psb[2] = {"Impossible", "Possible"};
string psb[2] = {"impossible", "possible"};

ll inq(ll x, ll y)
{
    if (!y) re 1 % MOD;
    ll l = inq(x, y / 2);
    if (y % 2) re l * l % MOD * x % MOD;
    re l * l % MOD;
}

ll rev(ll x)
{
    return inq(x, MOD - 2);
}

bool __precomputed_combinatorics = 0;
vector<ll> __fact, __ufact, __rev;

void __precompute_combinatorics()
{
    __precomputed_combinatorics = 1;
    __fact.resize(FN);
    __ufact.resize(FN);
    __rev.resize(FN);
    __rev[1] = 1;
    for (int i = 2; i < FN; i++) __rev[i] = MOD - __rev[MOD % i] * (MOD / i) % MOD;
    __fact[0] = 1, __ufact[0] = 1;
    for (int i = 1; i < FN; i++) __fact[i] = __fact[i - 1] * i % MOD, __ufact[i] = __ufact[i - 1] * __rev[i] % MOD;
}

ll fact(int x)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[x];
}

ll cnk(int n, int k)
{
    if (k < 0 || k > n) return 0;
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[n] * __ufact[n - k] % MOD * __ufact[k] % MOD;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, m;
    cin >> n >> m;
    vector<string> s(n);
    forn(i, n) cin >> s[i];
    vector<int> r(n), c(m);
    forn(i, n) forn(j, m) if (s[i][j] == '#') r[i] = 1, c[j] = 1;
    forn(i, n)
    {
        forn(j, m)
        {
            if (r[i] && c[j]) cout << s[i][j];
        }
        if (r[i])
        cout << "\n";
    }
}

/* Note:
Check constants at the beginning of the code.
    N is set to 4e5 but be careful in problems with large constant factor.
    Setting N in every problem is more effective.
Check corner cases.
    N = 1
No def int long long for now.
Add something here.
*/


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <deque>
#include <set>
#include <numeric>
using namespace std;
using ll = long long;

#define no "no"
#define No "No"
#define NO "NO"
#define yes "yes"
#define Yes "Yes"
#define YES "YES"
#define next '\n'
#define sp " "
#define print(x) cout << (x)
#define println(x) cout << (x) << next
#define stop return(0)
#define rep(i, n) for(int (i) = (0); (i) < (n); (++i))
#define FOR(i, start, end) for(int (i) = (start); (i) < (end); (++i))
#define foreach(elem, _list) for(auto& (elem) : (_list))
#define view(_list) foreach(e, _list){ cout << e << sp; } cout << next
#define FAST ios::sync_with_stdio(false); cin.tie(nullptr)
#define size(s) (s).size()
#define ALL(vec) (vec).begin(), (vec).end()
#define pb(e) push_back(e)
#define INF 1e+9
#define PI acos(-1)
#define TAU PI * 2
#define EPS 0.00000001
const ll MOD = 998244353;

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

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

int main()
{
	int n;
	cin >> n;
	map<string, int> mp;
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		if (mp.count(s)) mp[s]++;
		else mp[s] = 1;
	}
	cout << mp.size() << endl;
}


Measured memory_bytes: 19260
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define repR(i, n) for(ll i = n; i >= 0; i--)
#define For(i, m, n) for(ll i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
typedef long double ld;
using namespace std;
struct Fast {Fast(){std::cin.tie(0);std::ios::sync_with_stdio(false);}} fast;
ll gcd(ll a, ll b){
    ll r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

bool vector_find(std::vector<ll> vec, ll number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance( vec.begin(), itr );
    if (index != vec.size()) {
        return true;
    }
    else {
        return false;
    }
}


int main(void){
    double result;
    double T, X;
    cin >> T >> X;
    result = T / X;
    
    cout << result << endl;
    return 0;
}


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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  vector<int> a(3);
  cin >> a[0] >> a[1] >> a[2];
  sort(a.begin(),a.end());
  cout << a[2]*10+a[1]+a[0] << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

int n, hx, hy, dx, dy;
int cx[20], cy[20];

bool dfs(int bit, int x, int y, double t) {
    if (bit == (1 << n) - 1) return true;
    REP (i, n) if (!(bit >> i & 1)) {
        if (hypot(x - cx[i], y - cy[i]) > hypot(dx - cx[i], dy - cy[i]) - t) {
            return false;
        }
    }
    REP (i, n) if (!(bit >> i & 1)) {
        if (hypot(x - cx[i], y - cy[i]) < hypot(dx - cx[i], dy - cy[i]) - t) {
            if (dfs(bit | (1 << i), cx[i], cy[i], t + hypot(x - cx[i], y - cy[i]))) return true;
        }
    }
    return false;
}

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

    int t = 1;
    while (cin >> n >> hx >> hy >> dx >> dy, n) {
        REP (i, n) cin >> cx[i] >> cy[i];
        cout << (dfs(0, hx, hy, 0) ? "YES" : "NO") << endl;
    }
}


Measured memory_bytes: 3184
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n, m;
ll x, y;

int main()
{
  cin>>n>>m>>x>>y;
  double ans = n * m / 2.0;
  printf("%.8f ", ans);
  if(x == n / 2 && y == m / 2 && n % 2 == 0 && m % 2 == 0) puts("1");
  else puts("0");
  return 0;
}


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

using namespace std;

int N;
int A[18][2];
int dp[1 << 18][18];

int main() {
   ios_base::sync_with_stdio(false);
   cin >> N;
   for (int i = 0; i < N; ++i) cin >> A[i][0];
   for (int i = 0; i < N; ++i) cin >> A[i][1];
   for (int i = 1; i < N; i += 2) swap(A[i][0], A[i][1]);
   for (int mask = 0; mask < (1 << N); ++mask) {
      for (int last = 0; last < N; ++last) {
         dp[mask][last] = 1 << 30;
      }
   }
   for (int i = 0; i < N; ++i) {
      dp[1 << i][i] = 0;
   }
   for (int mask = 1; mask + 1 < (1 << N); ++mask) {
      int cnt = __builtin_popcount(mask);
      for (int last = 0; last < N; ++last) {
         if (dp[mask][last] == (1 << 30)) continue;
         for (int nxt = 0; nxt < N; ++nxt) if (!(mask & (1 << nxt)) && A[last][cnt & 1 ^ 1] <= A[nxt][cnt & 1]) {
            dp[mask | (1 << nxt)][nxt] = min(dp[mask | (1 << nxt)][nxt], dp[mask][last] + cnt - __builtin_popcount(mask & ((1 << nxt) - 1)));
         }
      }
   }
   int ans = *min_element(dp[(1 << N) - 1], dp[(1 << N) - 1] + N);
   if (ans == (1 << 30)) {
      ans = -1;
   }
   cout << ans << "\n";
   return 0;
}


Measured memory_bytes: 18688
n,k = map(int,input().split())
a = list(map(int,input().split()))
b = [a[0]]
for i in range(n-1):
    b.append(b[i]+a[i+1])
s = b
for i in range(n-1):
    for j in range(i,n-1):
        s.append(b[j+1]-b[i])
s.sort(reverse=True)
l = len(bin(s[0]))-2
d = 1<<l-1
t = 0
while d>0:
    s1 = []
    if s[k-1] >= d:
        t += d
        for i in s:
            if i >= d:
                s1.append(i)
            else:
                s=s1
                break
    for i in range(len(s)):
        if s[i] >= d:
            s[i] -= d
        else:
            s.sort(reverse=True)
            break
    d = d>>1
print(t)

Measured memory_bytes: 27440
use std::io;

fn read_lines() -> Vec<char> {
    let mut line = String::new();
    let mut inputs = Vec::<i32>::new();
    io::stdin().read_line(&mut line).unwrap();
    let n_num = line.trim().parse::<i32>().unwrap();
    line.clear();
    io::stdin().read_line(&mut line).unwrap();
    let inputs: Vec<char> = line.chars().collect();
    inputs
}

fn solve(inputs: Vec<char>) -> i32 {
    let mut min_nb_change = inputs.len() as i32;
    let mut nb_change = 0;
    for i in 1..inputs.len() {
        if inputs[i] == 'E' {
            nb_change += 1;
        }
    }
    if nb_change < min_nb_change {
        min_nb_change = nb_change
    }

    for i in 1..inputs.len() {
        if inputs[i - 1] == 'W' {
            nb_change += 1;
        }
        if inputs[i] == 'E' {
            nb_change -= 1;
        }
        if nb_change < min_nb_change {
            min_nb_change = nb_change
        }
    }

    return min_nb_change;
}

fn main() {
    let inputs = read_lines();
    let res = solve(inputs);
    println!("{}", res);
}


Measured memory_bytes: 3592
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int min = Integer.MAX_VALUE,max = Integer.MIN_VALUE;
        for (int i = 0;i < a;++i){
            int b = scanner.nextInt();
            if(b < min)min = b;
            if(b > max)max = b;
        }
        System.out.println(max - min);
    }
}


Measured memory_bytes: 21844
#include <stdio.h>

int main(){
    int n, x;
    int cnt;
    scanf("%d %d", &n, &x);
    while(!(n==0&&x==0)){
        cnt=0;
        for (int i = 1; i <=n; i++)
        {
            for (int j = i+1; j <=n; j++)
            {
                for (int k = j+1; k <=n; k++)
                {
                    if(i+j+k==x)cnt++;
                }
                
            }
            
        }
        printf("%d\n", cnt);
        
        scanf("%d %d", &n, &x);
    }
}


Measured memory_bytes: 2036
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin(), v.end()
bool chmin(ll & a, ll  b) { if (b < a) { a = b; return 1; } return 0; }
bool chmax(ll & a, ll b) { if (b > a) { a = b; return 1; } return 0; }
const ll INF = 999999999999999;
const ll MOD = 1000000007;
const ll MAX_N=500010;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans;
int main() {
    string s;
    cin>>s;
    if(s=="hi"||s=="hihi"||s=="hihihi"||s=="hihihihi"||s=="hihihihihi")cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

}


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

int main() {
  int n,m,k,a,i,j,c[111111];
  cin>>n>>m;
  for(i=0;i<111;i++)
    c[i]=0;
  for(i=0;i<n;i++){
    cin>>k;
    for(j=0;j<k;j++){
      cin>>a;
      c[a]++;
    }
  }
  int ans=0;
  for(i=0;i<=m;i++){
    if(c[i]==n)
      ans++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
/*
sonu_verma1
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb(a) push_back(a)
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
int main()
{
	ll n,i,sm=0;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		if(i%3!=0&&i%5!=0)
			sm+=i;
	}
	cout<<sm;


	return 0;
}

Measured memory_bytes: 3636
import sys
S = input()
Odd = []
Even = []
for i,s in enumerate(S):
    if (i+1) % 2 == 1:
        Odd.append(s)
    else:
        Even.append(s)

for odd in Odd:
    if odd == 'L':
        print('No')
        sys.exit()
for even in Even:
    if even == 'R':
        print('No')
        sys.exit()

print('Yes')


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

struct Trie{
    int next[100][26];
    int cnt[100];
    int root,sz;
    void init()
    {
        memset(next,-1,sizeof(next));
        memset(cnt,0,sizeof(cnt));
        root = sz = 0;
    }

    void insert(char *str)
    {
        int now = root,index;
        while(*str)
        {
            index = *(str++) - 'a';
            if(next[now][index] == -1)
                next[now][index] = ++sz;
            now = next[now][index];
        }
        cnt[now]++;
    }

    bool query(char*& str)
    {
        int now = root,index;
        while(*str)
        {
            index = *(str++) - 'a';
            now = next[now][index];
            if(now == -1) return false;
            if(cnt[now] != 0) return true;
        }
    }
}TT;
const int MAXN = 1e5+10;
char str[MAXN];

int main()
{
    TT.init();
    TT.insert("maerd");
    TT.insert("remaerd");
    TT.insert("esare");
    TT.insert("resare");
    scanf("%s",str);
    int len = strlen(str);
    for(int i = 0; i < len/2; ++i)
        swap(str[i],str[len-i-1]);
    char *s = str;
    while(*s)
    {
        if(TT.query(s) == false)
        {
            puts("NO");
            return 0;
        }
    }
    puts("YES");
    return 0;
}


Measured memory_bytes: 384
N,M = gets.split.map(&:to_i)
stus,cpts = [],[]

N.times do
  stus << gets.split.map(&:to_i)
end

M.times do
  cpts << gets.split.map(&:to_i)
end

stus.each do |st|
  min_id,min = 1,200000001
  cpts.each.with_index(1) do |cp, id|
    dist = (st[0]-cp[0]).abs + (st[1]-cp[1]).abs
    if dist < min
      min = dist
      min_id = id
    end
  end
  puts min_id
end

Measured memory_bytes: 3836
k = 0
while k == 0:
    a, op, b = input().split()
    a = int(a)
    b = int(b)
    if op == '+':
        print(a+b)
    elif op == '-':
        print(a-b)
    elif op == '*':
        print(a*b)
    elif op == '/':
        print(a//b)
    else:
        k = 1



Measured memory_bytes: 5592
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<ctime>
#include<algorithm>
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<map>
using namespace std;
double Rel[30][30];
struct Point
{
    double x,y,z;
}P[30];
int main()
{
    int s,i,j,M,N;
    double Ans,tmp;
    while (~scanf("%d%d",&N,&M))
    {
        for (i=0;i<N;i++)
            scanf("%lf%lf%lf",&P[i].x,&P[i].y,&P[i].z);
        for (i=0;i<N;i++)
        {
            Rel[i][i]=0;
            for (j=i+1;j<N;j++)
                Rel[i][j]=Rel[j][i]=(P[i].x-P[j].x)*(P[i].x-P[j].x)+(P[i].y-P[j].y)*(P[i].y-P[j].y)+(P[i].z-P[j].z)*(P[i].z-P[j].z);
        }
        Ans=0;
        for (s=1;s<(1<<N);s++)
            if (__builtin_popcount(s)==M)
            {
                tmp=0;
                for (i=0;i<N;i++)
                    if (s&(1<<i))
                        for (j=i+1;j<N;j++)
                            if (s&(1<<j))
                                tmp+=Rel[i][j];
                if (tmp>Ans)
                    Ans=tmp;
            }
        printf("%.15lf\n",Ans);
    }
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define int long long
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 


signed main(){
  int n;cin>>n;int sunuke,arai = 0;cin>>sunuke;int a[200000];a[0] = sunuke;
  repd(i,1,n){
    cin>>a[i];
    arai += a[i];
  }
  int ans = abs(arai-sunuke);
  repd(i,1,n-1){
    sunuke += a[i];arai -= a[i];
    ans = min(ans, abs(arai-sunuke));
  }
  cout << ans << endl;
}


Measured memory_bytes: 1792
#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>


typedef long double ld;
typedef long long ll;

using namespace std;

int main() {
	string s;
	cin >> s;
	int n = s.length();
	for (int i = 0; i < n; i++) {
		if (s[i] == '?') {
			s[i] = 'D';
		}
	}
	cout << s << endl;
	return 0;
}


Measured memory_bytes: 3756
# 素因数分解
def f(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

n = int(input())

mod = 10**9+7
cnt = [0] * (n+1)

for i in range(1, n+1):
    F = f(i)
    for j in range(len(F)):
        cnt[F[j][0]] += F[j][1]

ans = 1
for i in range(2, len(cnt)):
    ans *= cnt[i] + 1
    ans %= mod

print(ans)

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

int main() {
  char input;
  cin >> input;

  if (input != 'A' && input != 'C' && input != 'G' && input != 'T') {
	cout << "入力が間違っています" << endl;
  } else {
	switch (input) {
		case 'A':
			cout << 'T' << endl;
			break;
		case 'C':
			cout << 'G' << endl;
			break;
		case 'G':
			cout << 'C' << endl;
			break;
		case 'T':
			cout << 'A' << endl;
			break;
		dafault:
			break;
	}
  }
}

Measured memory_bytes: 256
n = int(input())
indexB =0
blueL =[]
while indexB<n:
    blueL.append(input())
    indexB+=1

m = int(input())
indexR =0
redL =[]
while indexR<m:
    redL.append(input())
    indexR+=1

blueL.sort()
length = len(blueL)
index1 =0
ansM=0
while index1<length:
    money =0
    for blueC in blueL:
        if blueL[index1] ==blueC:
            money+=1
    for redC in redL:
        if blueL[index1] ==redC:
            money-=1
    if ansM<money:
        ansM=money
    index1+=1

print(ansM)

Measured memory_bytes: 3064
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import defaultdict
def main():
    A=input()
    len_a=len(A)
    dp=[0]*len_a
    dp[0]=1
    dd=defaultdict(int)
    dd[A[0]]+=1
    for i in range(1,len_a):
        a=A[i]
        dp[i]=i-dd[a]
        dd[a]+=1
    print(sum(dp))

if __name__=='__main__':
    main()

Measured memory_bytes: 11492
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 c = sc.nextInt();
		
		if(a == b) {
			System.out.println(c);
		}else if(b == c) {
			System.out.println(a);
		}else {
			System.out.println(b);
		}
	}

}


Measured memory_bytes: 24148
def main():
    n, x = map(int, raw_input().split())
    ll = map(int, raw_input().split())
    d = 0
    ans = 1
    for l in ll:
        d += l
        if d <= x:
            ans += 1
        else:
            break
    print ans


if __name__ == '__main__':
    main()


Measured memory_bytes: 28012
import numpy as np
N,K=map(int,input().split())
P=list(map(int,input().split()))
Q=[0]
def ex(A):
  return (1+A)/2.0
for i in range(N):
  Q.append(ex(P[i]))
Q=np.array(Q)
R=Q.cumsum()
ans=0
for i in range(K,N+1):
  S=R[i]-R[i-K]
  if ans<S:
    ans=S
print(ans)

Measured memory_bytes: 34008
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Sparsh Sanchorawala
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CSqrtInequality solver = new CSqrtInequality();
        solver.solve(1, in, out);
        out.close();
    }

    static class CSqrtInequality {
        public void solve(int testNumber, InputReader s, PrintWriter w) {
            long a = s.nextLong(), b = s.nextLong(), c = s.nextLong();
            if (c <= a + b) {
                w.println("No");
                return;
            }
            long val = c - a - b;
            if (val <= (int) 2e9 && 4 * a * b < val * val)
                w.println("Yes");
            else
                w.println("No");
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 22868
#include<stdio.h>
#include<math.h>
#ifdef DEBUG
#include<conio.h>
#endif // DEBUG


int main () {
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif // DEBUG

    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    int cnt = 0;
    for (size_t i = a; i <= b; i++)
    {
        if(0 == c % i) ++cnt;
    }
    printf("%d\n", cnt);
#ifdef DEBUG
    getch();
#endif // DEBUG
    return 0;
}




Measured memory_bytes: 2132
import java.util.*;

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

        int num = 0;
        int min = 124;
        int max = -1;
        for (int i = 0 ; i < 6 ; i++) {
            num = scan.nextInt();
            if (min > num) {
                min = num;
            }
            if (max < num) {
                max = num;
            }
        }
        
        if ((max - min) > num){
            System.out.println(":(");
        } else {
            System.out.println("Yay!");
        }
    }
}


Measured memory_bytes: 21332
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()
template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin>>n;
    vector<int> v(n);
    rep(i,n){
        cin>>v[i];
    }
    map<int,int> od, ev;
    rep(i,n){
        if(i%2==0){
            ev[v[i]]++;
        }else{
            od[v[i]]++;
        }
    }
    vector<pair<int,int>> tod, tev;
    tod.push_back(make_pair(0, -1));
    tev.push_back(make_pair(0, -1));
    for(auto a : od){
        tod.emplace_back(make_pair(a.second, a.first));
    }
    for(auto a : ev){
        tev.emplace_back(make_pair(a.second, a.first));
    }
    sort(tod.rbegin(), tod.rend());
    sort(tev.rbegin(), tev.rend());
    ll ans = 0;
    if(tod[0].second == tev[0].second){
        if(tod[1].first>tev[1].first){
            // cerr<<"a"<<endl;
            ans = n - tev[0].first - tod[1].first;
        } else {
            // cerr<<"b"<<endl;
            ans = n-tev[1].first - tod[0].first;
        }
    } else {
        // cerr<<"c"<<endl;
        ans = n- tev[0].first - tod[0].first;
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 6524