akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <forward_list>

using namespace std;

typedef long long ll;
typedef vector<long long> vi;
typedef pair<long long, long long> ii;
typedef vector<pair<long long, long long>> vii;
typedef stringstream ss;
ll mil() { return numeric_limits<long long>::min(); }
ll mal() { return numeric_limits<long long>::max(); }

#define R3(i, a, b) for (long long i = (a); i < (b); ++i)
#define R2(i, b) for (long long i = 0; i < (b); ++i)
#define R1(b) for (long long i = 0; i < (b); ++i)
#define RR(i, a, b) for (long long i = a; i > b; --i)
#define PB(x) push_back(x)
#define MP(x, y) make_pair(x, y)

// build: ctrl + f9

// run: shift + f10
// sanitize: shift + f11
// debug: shift + f9

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

    R1(3) {
        ll nd = N-(floor(N/10)*10);
        if(nd == 7) {
            cout << "Yes" << endl;
            return 0;
        }
        N/=10;
    }

    cout << "No" << endl;
}

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

using namespace std;

int bitstrtoint(string str){
  int res = 0;
  for(int i = 0; i < str.size(); i++){
    res *= 2;
    res += str[i] == '1';
  }
  return res;
}

int main(){
  string str;
  while(getline(cin, str)){
    string numstr = "";
    for(int i = 0; i < str.size(); i++){
      switch((char)str[i]){
      case ' ':
        numstr += "101";
        break;
      case '\'':
        numstr += "000000";
        break;
      case ',':
        numstr += "000011";
        break;
      case '-':
        numstr += "10010001";
        break;
      case '.':
        numstr += "010001";
        break;
      case '?':
        numstr += "000001";
        break;
      case 'A':
        numstr += "100101";
        break;
      case 'B':
        numstr += "10011010";
        break;
      case 'C':
        numstr += "0101";
        break;
      case 'D':
        numstr += "0001";
        break;
      case 'E':
        numstr += "110";
        break;
      case 'F':
        numstr += "01001";
        break;
      case 'G':
        numstr += "10011011";
        break;
      case 'H':
        numstr += "010000";
        break;
      case 'I':
        numstr += "0111";
        break;
      case 'J':
        numstr += "10011000";
        break;
      case 'K':
        numstr += "0110";
        break;
      case 'L':
        numstr += "00100";
        break;
      case 'M':
        numstr += "10011001";
        break;
      case 'N':
        numstr += "10011110";
        break;
      case 'O':
        numstr += "00101";
        break;
      case 'P':
        numstr += "111";
        break;
      case 'Q':
        numstr += "10011111";
        break;
      case 'R':
        numstr += "1000";
        break;
      case 'S':
        numstr += "00110";
        break;
      case 'T':
        numstr += "00111";
        break;
      case 'U':
        numstr += "10011100";
        break;
      case 'V':
        numstr += "10011101";
        break;
      case 'W':
        numstr += "000010";
        break;
      case 'X':
        numstr += "10010010";
        break;
      case 'Y':
        numstr += "10010011";
        break;
      case 'Z':
        numstr += "10010000";
      }
    }
    str = "";
    if(numstr.size() % 5){
      numstr += string(5 - (numstr.size() % 5), '0');
    }
    for(int i = 0; i < numstr.size(); i += 5){
      int code = bitstrtoint(numstr.substr(i, 5));
      if(0 <= code && code < 26){
        str += (char)(code + 65);
      }
      else{
        switch(code){
        case 26:
          str += " ";
          break;
        case 27:
          str += ".";
          break;
        case 28:
          str += ",";
          break;
        case 29:
          str += "-";
          break;
        case 30:
          str += "\'";
          break;
        case 31:
          str += "?";
        }
      }
    }
    cout << str << "\n";
  }
  return 0;
}

Measured memory_bytes: 1192
#include <stdio.h>
long int gcd_recursive(unsigned a, unsigned b)
{
    if (b)
        return gcd_recursive(b, a % b);
    else
        return a;
}
int main (void)
{
    long long int a, b;
    long long int lcm, gcd;
    long long int i, j, big, small;
    int flag = 0;

    while(scanf("%lld%lld", &a, &b) != EOF){
        gcd = gcd_recursive(a, b);
        lcm = a * b / gcd;
        printf("%lld %lld\n", gcd, lcm);
    }
    return (0);
}


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

//O(F*V^2)

class MinimumCostFlow {
private:
  struct edge {
    int to, cap, cost, rev;
  };

  const int INF = 1e18;

  int V;
  vector<vector<edge>> G;
  vector<int> h, dist;
  vector<int> prevv, preve;

  void add_edge(int from, int to, int cap, int cost) {
    G[from].push_back({to, cap, cost, (int)G[to].size()});
    G[to].push_back({from, 0LL, -cost, (int)G[from].size() - 1LL});
  }

  int min_cost_flow(int s, int t, int f) {
    int res = 0;
    fill(h.begin(), h.end(), 0LL);

    while (f > 0) {
      using P = pair<int, int>;
      priority_queue<P, vector<P>, greater<P>> que;
      fill(dist.begin(), dist.end(), INF);
      dist[s] = 0;
      que.push(P(0, s));

      while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (dist[v] < p.first) continue;
        for (int i = 0; i < G[v].size(); i++) {
          edge &e = G[v][i];
          if (e.cap > 0 && dist[e.to] > dist[v] + e.cost + h[v] - h[e.to]) {
            dist[e.to] = dist[v] + e.cost + h[v] - h[e.to];
            prevv[e.to] = v;
            preve[e.to] = i;
            que.push(P{dist[e.to], e.to});
          }
        }
      }

      if (dist[t] == INF) {
        return -1;
      }

      for (int v = 0; v < V; v++) {
        h[v] += dist[v];
      }

      int d = f;
      for (int v = t; v != s; v = prevv[v]) {
        d = min(d, G[prevv[v]][preve[v]].cap);
      }
      f -= d;
      res += d * h[t];
      for (int v = t; v != s; v = prevv[v]) {
        edge &e = G[prevv[v]][preve[v]];
        e.cap -= d;
        G[v][e.rev].cap += d;
      }
    }
    return res;
  }

public:
  MinimumCostFlow(int N) : V(N), G(N, vector<edge>()), h(N), dist(N), prevv(N), preve(N) {}

  void addEdge(int from, int to, int cap, int cost) {
    return add_edge(from, to, cap, cost);
  }
  int minCostFlow(int s, int t, int f) {
    return min_cost_flow(s, t, f);
  }
};

signed main() {
  int V, E, F;
  cin >> V >> E >> F;

  MinimumCostFlow mcf(V);

  for (int i = 0; i < E; i++) {
    int u, v, c, d;
    cin >> u >> v >> c >> d;
    mcf.addEdge(u, v, c, d);
  }

  cout << mcf.minCostFlow(0, V - 1, F) << endl;
  return 0;
}



Measured memory_bytes: 3276
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const int inf=1e9+7;

int main(){
    int n;cin>>n;
    set<int> ans;
    rep(i,n){
        int d;cin>>d;
        ans.insert(d);
    }
    cout<<ans.size()<<endl;
}

Measured memory_bytes: 384
module Main where

import qualified Data.ByteString.Char8         as BS
import           Data.List
import           Data.Char

main :: IO ()
main = do
  [a, b, x] <- map fromIntegral . unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  let s = x / a :: Double
  print $ if s >= a * b / 2
    then let c = (2 * b) - (2 * s / a) in 90 - atan (a / c) / pi*180
    else let c = (2 * s) / b in 90 - atan (c / b) / pi*180


Measured memory_bytes: 508
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int N; long long C;
	cin >> N >> C;
	vector<long long> X(N), V(N);
	for (int i = 0; i < N; ++i) {
		cin >> X[i] >> V[i];
	}
	long long ans = -1;
	for (int i = 0; i < 2; ++i) {
		vector<long long> sl(N + 1), sr(N + 1);
		for (int j = 0; j < N; ++j) {
			sl[j + 1] = sl[j] + V[j] - (X[j] - (j == 0 ? 0 : X[j - 1]));
		}
		for (int j = N - 1; j >= 0; --j) {
			sr[j] = sr[j + 1] + V[j] - ((j == N - 1 ? C : X[j + 1]) - X[j]) * 2;
		}
		for (int j = 0; j < N; ++j) {
			sl[j + 1] = max(sl[j + 1], sl[j]);
		}
		for (int j = N - 1; j >= 0; --j) {
			sr[j] = max(sr[j], sr[j + 1]);
		}
		for (int j = 0; j <= N; ++j) {
			ans = max(ans, sl[j] + sr[j]);
		}
		reverse(X.begin(), X.end());
		reverse(V.begin(), V.end());
		for (int j = 0; j < N; ++j) {
			X[j] = C - X[j];
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3424
s = input()
y = s[:4]
m = s[5:7]
d = s[-2:]
if int(y) < 2019 or (int(y) == 2019 and int(m) < 4) or (int(y) == 2019 and int(m) == 4 and int(d) <= 30):
  print('Heisei')
else:
  print('TBD')

Measured memory_bytes: 2940
#include <iostream>
#include <cmath>

using namespace std;
using ll = long long;

int main() {
	ll N, A, B;
	int pre, now;
	ll ans = 0;

	cin >> N >> A >> B;
	cin >> now;
	for (int i = 1; i < N; i++) {
		pre = now;
		cin >> now;
		ans += min((now - pre) * A, B);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define MODB 998244353
#define INF 9223372036854775807

signed main()
{
  int x=0,y=0,z=0,w=0,n=0,m=0;
  string s,t;
  std::cin >>x>> s>>t;
  rep(i,x){
    std::cout << s[i] ;
    std::cout << t[i];
  }
  std::cout << '\n';

}


Measured memory_bytes: 256
n = int(input())
a = [0] + list(map(int, input().split())) + [0]

b = [0]

for i in range(len(a)-1):
    b.append(abs(a[i+1]-a[i]) + b[-1])

s = b[-1]

for i in range(1, len(a)-1):
    ans = s - abs(a[i] - a[i-1]) - abs(a[i+1] - a[i]) + abs(a[i+1] - a[i-1])
    print(ans)

Measured memory_bytes: 65900
s = input()
a = int(s[0])
b = int(s[1])
c = int(s[2])
d = int(s[3])
while True:
    if a + b + c + d == 7:
        print('%d+%d+%d+%d=7'%(a,b,c,d))
        break
    if a + b + c - d == 7:
        print('%d+%d+%d-%d=7'%(a,b,c,d))
        break
    if a + b - c + d == 7:
        print('%d+%d-%d+%d=7'%(a,b,c,d))
        break
    if a + b - c - d == 7:
        print('%d+%d-%d-%d=7'%(a,b,c,d))
        break
    if a - b - c - d == 7:
        print('%d-%d-%d-%d=7'%(a,b,c,d))
        break
    if a - b + c + d == 7:
        print('%d-%d+%d+%d=7'%(a,b,c,d))
        break
    if a - b + c - d == 7:
        print('%d-%d+%d-%d=7'%(a,b,c,d))
        break
    if a - b - c + d == 7:
        print('%d-%d-%d+%d=7'%(a,b,c,d))
        break

Measured memory_bytes: 3064
N = int(input())
ans_list = [0 for _ in range(1,10100)]

for i in range(1,100):
    for j in range(1,100):
        for k in range(1,100):
            value = i**2 + j**2 + k**2 + i*j + j*k + k*i
            if value <= 10000:
                ans_list[value] += 1

for i in range(1, N+1):
    print(ans_list[i])

Measured memory_bytes: 9136
class UnionFind :
    def __init__(self, size) :
        self.parent = list(range(size))
        self.height = [0] * size
        self.size = [1] * size
        self.component = size

    def root(self, index) :
        if self.parent[index] == index :  # 根の場合
            return index
        rootIndex = self.root(self.parent[index])  # 葉の場合親の根を取得
        self.parent[index] = rootIndex  # 親の付け直し
        return rootIndex

    def union(self, index1, index2) :  # 結合
        root1 = self.root(index1)
        root2 = self.root(index2)

        if root1 == root2 :  # 連結されている場合
            return

        self.component -= 1  # 連結成分を減らす

        if self.height[root1] < self.height[root2] :
            self.parent[root1] = root2  # root2に結合
            self.size[root2] += self.size[root1]
        else :
            self.parent[root2] = root1  # root1に結合
            self.size[root1] += self.size[root2]
            if self.height[root1] == self.height[root2] :
                self.height[root1] += 1
        return

    def isSameRoot(self, index1, index2) :
        return self.root(index1) == self.root(index2)

    def sizeOfSameRoot(self, index) :
        return self.size[self.root(index)]

    def getComponent(self) :
        return self.component

N, M = map(int, input().split())
P = list(map(int, input().split()))
tree = UnionFind(N)

for _ in range(M):
    a, b = map(int, input().split())
    tree.union(a - 1, b - 1)

ans = 0
for i, p in enumerate(P):
    if tree.isSameRoot(i, p - 1):
        ans += 1
print(ans)


Measured memory_bytes: 13812
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
int n,m;
int k[33],a[33][33];
int c[333];
signed main(){
	cin>>n>>m;
	rep(i,n){
		cin>>k[i];
		rep(j,k[i]){
			cin>>a[i][j];
			a[i][j]--;
			c[a[i][j]]++;
		}
	}
	int ans=0;
	rep(i,m)if(c[i]==n)ans++;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int H,N,A[10000],B[10000];
	long D[100000]={0},res=100000000;
	
	cin>>H>>N;
	for(int i=0;i<N;i++)cin>>A[i]>>B[i];
	for(int i=0;i<N;i++){
		for(int j=0;j<H;j++){
			if(D[j]==0&&j>0)continue;
			if(D[j+A[i]]==0||D[j+A[i]]>D[j]+B[i]){
				D[j+A[i]]=D[j]+B[i];
				if(j+A[i]>=H)res=min(res,D[j+A[i]]);
			}
		}
	}
	cout<<res;
	return 0;
}

Measured memory_bytes: 1024
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        char[] charArray = sc.next().toCharArray();

        for (char c: charArray) {
            if (c == '7') {
                System.out.println("Yes");
                return;
            }
        }
        
        System.out.println("No");
    }
}


Measured memory_bytes: 35760
#include <bits/stdc++.h>
using namespace std;
#define int                     long long int
#define ld                      long double
#define pb                      push_back
#define MOD                     1000000007
#define inf                     3e18
#define vi                      vector<int>
#define vld                     vector<ld>
#define pii                     pair<int,int>
#define mii                     map<int,int>
#define fi                      first
#define se                      second
#define fastIO                  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << " "<< name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

void inp_out()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
    #endif
}

int32_t main()
{
	fastIO
//	inp_out();
	string s,t;
	cin>>s>>t;
	int flag=0;
	if(s.size()!=(t.size()-1))
	{
		cout<<"No";
		return 0;
	}
	for(int i=0;i<s.size();++i)
		if(s[i]!=t[i])
			flag=1;	
	if(flag)
		cout<<"No";
	else cout<<"Yes";
	return 0;
}

Measured memory_bytes: 3652
package main

import (
	"bufio"
	_ "container/heap"
	"fmt"
	"os"
	"sort"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

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

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const MOD = int(1e+9) + 7
const INF = 1 << 60

type Cake struct {
	x, y, z int
}

type ByTotal []Cake

func (a ByTotal) Len() int           { return len(a) }
func (a ByTotal) Less(i, j int) bool { return total(a[i]) > total(a[j]) }
func (a ByTotal) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

var total func(cake Cake) int

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	defer wtr.Flush()
	N, M := sc.nextInt(), sc.nextInt()
	C := make([]Cake, N)
	for i := 0; i < N; i++ {
		C[i].x, C[i].y, C[i].z = sc.nextInt(), sc.nextInt(), sc.nextInt()
	}
	ans := 0
	dx := []int{1, 1, 1, 1, 0, 0, 0, 0}
	dy := []int{1, 0, 0, 1, 1, 1, 0, 0}
	dz := []int{1, 0, 1, 0, 1, 0, 1, 0}
	for d := 0; d < 8; d++ {
		total = func(cake Cake) int {
			var res int
			if dx[d] > 0 {
				res += -cake.x
			} else {
				res += cake.x
			}
			if dy[d] > 0 {
				res += -cake.y
			} else {
				res += cake.y
			}
			if dz[d] > 0 {
				res += -cake.z
			} else {
				res += cake.z
			}
			return res
		}
		sort.Sort(ByTotal(C))
		var xx, yy, zz int
		for i := 0; i < M; i++ {
			xx += C[i].x
			yy += C[i].y
			zz += C[i].z
		}
		if ans < abs(xx)+abs(yy)+abs(zz) {
			ans = abs(xx) + abs(yy) + abs(zz)
		}
	}
	fmt.Fprintln(wtr, ans)
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define pp pair<ll,ll>
#define all(v) (v).begin(),(v).end()
#define sz(v) (int)v.size()
#define F first 
#define S second 
#define lc "\n"
ll power(ll x,ll y,ll p){ll res=1;x=x%p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;} 
ll MAX=1e18 , MIN=-1e18 , MOD=1000000007;
int main() 
{
    fastio
    int n,i,ans=0; cin>>n; int a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        if(i%2==0 && a[i]%2==1) ans++;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3604
import java.util.*;
import java.lang.Math;

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

	while(true){
	    int N=sc.nextInt();
	    if(N==0) break;
	    
	    int ave =0;
	    int max=0,min=1001;

	    for(int i=0;i<N;i++){
		int t= sc.nextInt();
		if(t<min) min=t;
		if(t>max) max=t;
		ave+=t;
	    }
	    ave= ave-(min+max);

	    System.out.println(ave/(N-2));
	}
    }

}

Measured memory_bytes: 12000
using System.Text;
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        var a = new int[n];
        var b = new int[n];
        for (int i = 0; i < n; i++)
        {
            a[i] = int.Parse(Console.ReadLine().Trim());
            b[i] = a[i];
        }
        Array.Sort(a);
        var bmax = a[n - 1].ToString() + "\n";
        var bmax2 = a[n - 2].ToString() + "\n";
        var sb = new StringBuilder();
        for (int i = 0; i < n; i++)
            sb.Append(b[i] == a[n - 1] ? bmax2 : bmax);
        Console.WriteLine(sb);
    }
}


Measured memory_bytes: 26204
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll inf = 3e18;
const char sp = ' ';


int N, A;
pair<int, int>res = { mod,mod };

int main() {
	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> A;
		res = min(res, pair<int,int>{ A,i });
	}
	cout << res.second << endl;
}


Measured memory_bytes: 3100
#include<iostream>
#include<set>
#include<cassert>
#include<cmath>
#include<vector>
#include<algorithm>

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define inf (1<<29)

using namespace std;

typedef pair<int,int> ii;
set<string> used;
int cnt = 0;
ii raint[4];

void dfs(int cur,int st,string perm)
{
  if(cur >= 8)
    {
      if(used.find(perm) != used.end())return;
      used.insert(perm);
      rep(i,16)if(perm[i] == 'x')return;
	cnt++;
      return;
    }

  REP(i,st,16)
    {
      int x = i%4;
      int y = i/4;
      rep(j,4)
	{
	  int nx = x + raint[j].first;
	  int ny = y + raint[j].second;
	  if(!(0 <= nx && nx < 4 && 0 <= ny && ny < 4))continue;
	  if(perm[nx+ny*4] != 'x')continue;
	  string nperm = perm;
	  nperm[x+y*4] = nperm[nx+ny*4] = (char)('0'+cur);
	  dfs(cur+1,i+1,nperm);
	}
    }

}

int main()
{
  while(cin >> raint[0].first,raint[0].first <= 4)
    {
      used.clear();
      cin >> raint[0].second;
      REP(i,1,4)cin >> raint[i].first >> raint[i].second;
      cnt = 0;
      string perm = string(16,'x');

      dfs(0,0,perm);

      cout << cnt << endl;
    }
}

Measured memory_bytes: 6992
import sys
while 1:
    H, W = map(int, raw_input().split())
    if H == 0 and W == 0:
        break
    else:
        for j in xrange(H):
            for i in xrange(W):
                if (i + j) % 2 == 0:
                    sys.stdout.write("#")
                else:
                    sys.stdout.write(".")
            print ""
        print ""

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))

typedef long long LL;

int main(){
  int n,x;
  cin >> n >> x;
  vector<int> a(n);
  for(int i=0;i<n;i++) cin >> a[i];
  sort(a.begin(),a.end());
  int ans=0;
  for(int i=0;i<n-1;i++){
    if(x>=a[i]){
      ans++;
      x-=a[i];
    }
  }
  if(x==a[n-1]) ans++;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#define rep(i,l,n) for(lint i=l;i<n;i++)
#define rer(i,l,n) for(lint i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef vector<lint> vli;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main(){
	int n;
	while(1){
		cin>>n;
		if(n==0) break;
		lint dp[35]={},ans;
		dp[1]=1;
		dp[2]=2;
		dp[3]=4;
		if(n>3){
			rep(i,4,n+1){
				dp[i]=dp[i-1]+dp[i-2]+dp[i-3];
			}
		}
		ans=dp[n]/3650;
		if(dp[n]%3650) ans++;
		o(ans);
	}
}

Measured memory_bytes: 1156
#include <stdio.h>

int main(void) {
	int n, a[99];
	
	scanf("%d\n", &n);

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

	printf("%d\n", a[0]);
	return 0;
}

Measured memory_bytes: 2744
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 998244353;
const ll MAX = 1000000;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

//gcd,lcm,べき,二進展開
//組み合わせ、mod計算
//最短路問題、bit、union find

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

vector<ll> A;
ll N, M, V, P;

bool ch(ll k){
	auto itr1 = upper_bound(A.begin(), A.end(), A[k]);
	ll X = distance(A.begin(),itr1);
	auto itr2= upper_bound(A.begin(), A.end(), A[k]+M);
	ll Y = distance(A.begin(), itr2);

	

	if (N - Y >=P) { return false; }

	ll vote = 0;
	vote += M * (X + P - 1);

	

	for (int i = X; i <= N - P; i++) {
		vote += A[k] + M - A[i];
	}

	if (vote >= V * M) { return true; }
	return false;
}


int main() {
	cin >> N >> M >> V >> P;
	repn(i, N) {
		ll a;
		cin >> a;
		A.push_back(a);
	}

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

	
	ll l = -1;
	ll r = N;

	while(r-l>1){
		ll m = (l + r) / 2;
		
		if (!ch(m)) { l = m; }
		else { r = m; }
	}

	cout << N - r;

	
	system("PAUSE");


}

Measured memory_bytes: 1400
s = list(str(input()))
ans = []
score = 0
for i in range(len(s)):
    if i % 2 == 0:
        ans.append('g')
    else:
        ans.append('p')
for i in range(len(s)):
    if s[i] == 'p' and ans[i] == 'g':
        score -= 1
    elif s[i] == 'g' and ans[i] == 'p':
        score +=1
print(score)



Measured memory_bytes: 4780
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << a*b/2;

    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<bits/stdc++.h>
typedef long long int ll;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR_IN(i, a, b) for(int i = (a); i < (b); i++)
#define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b))
#define BIT(b, i) (((b) >> (i)) & 1)
#define LOG_F 1
#define LOG(...) if(LOG_F) fprintf(stderr, __VA_ARGS__)

using namespace std;

ll pow(int x, int n){
  return n == 0 ? 1 : x * pow(x, n - 1);
}


/*
s

s 100

ans++
 */
int s;
set<int> st;

int main(){
  cin>>s;

  int i;
  for(i=0; i<1000000; i++){
    if(st.count(s)==1) break;
    st.insert(s);
    if(s%2==0){
      s /= 2;
    } else {
      s = 3*s + 1;
    }
  }

  cout << i+1 <<endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int w[100010],b[100010],n,a,ans,tasu;

int main(){

    while(1){

    cin >> n;
    if(n==0)break;
    cin >> a;
    if(a==0){
        w[1]=1;
    }else{
        b[1]=1;
    }
    //printf("i=1 b=%d w=%d\n",b[1],w[1]);

    for(int i=2;i<=n;i++){
        cin >> a;
        if(i%2==0){
            if(a==1){
                if(w[i-1]>0){
                    b[i]=w[i-1]+1;
                    w[i-1]=0;
                    //printf(" b[i-b[i]]=%d\n b[i]=%d\n",b[i-b[i]],b[i]);

                    tasu=b[i-b[i]];
                    b[i-b[i]]=0;
                    b[i]+=tasu;
                }else if(b[i-1]>0){
                        b[i]=b[i-1]+1;
                        b[i-1]=0;
                    }else {
                        b[i]++;
                    }
            }else{
                if(b[i-1]>0){
                    w[i]=b[i-1]+1;
                    b[i-1]=0;
                    //printf("w[i-w[i]]=%d\n",w[i-w[i]]);
                    tasu=w[i-w[i]];
                    w[i-w[i]]=0;
                    w[i]+=tasu;
                }else if(w[i-1]>0){
                        w[i]=w[i-1]+1;
                        w[i-1]=0;
                    }else {
                        w[i]++;
                    }

            }
        }else{
            if(a==1){
                if(b[i-1]>0){
                    b[i]=b[i-1]+1;
                    b[i-1]=0;
                }else b[i]++;
            }else{
                if(w[i-1]>0){
                    w[i]=w[i-1]+1;
                    w[i-1]=0;
                }else w[i]++;

            }
        }
        //printf("i=%d b=%d w=%d\n",i,b[i],w[i]);
    }

    for(int i=1;i<=n;i++){
   //     cout << w[i] << endl;
  //  printf("i=%d b=%d w=%d\n",i,b[i],w[i]);
        if(w[i]>0)ans+=w[i];
    }

    cout << ans << endl;

    ans=0;
    for(int i=0;i<=n;i++){
        b[i]=0;
        w[i]=0;
    }

    }


return 0;
}

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

int main()
{
	int n;
	
	while (cin >> n, n){
		int p = 0, max = 0, max_n = 0, d1, d2;
		for (int i = 0; i < n; i++){
			cin >> p >> d1 >> d2;
			
			if(max < d1 + d2){
				max = d1 + d2;
				max_n = p;
			}
			
		}
		
		cout << max_n << ' ' << max << endl;
		
	}
	
	return (0);
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
 
using namespace std;
int main(){
  int N;
  cin >> N;
  int k = 0;
  for (int i=1;i<10;i++){
  	for (int j = 1; j < 10; j++){
    	if (N == i*j){
        	cout << "Yes" << endl;
          	k++;
          	break;
        }
    }
    if (k != 0){
    break;}
    }
  if (k == 0){
    cout << "No" << endl;
  }
}

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

using namespace std;

int main()
{
  int n;
  cin>>n;
  string a;
  map<string,int> m;
  for(int i=0;i<n;i++){
    cin>>a;
    m[a]++;
  }
  cout<<"AC x "<<m["AC"]<<endl;
  cout<<"WA x "<<m["WA"]<<endl;
    cout<<"TLE x "<<m["TLE"]<<endl;
    cout<<"RE x "<<m["RE"]<<endl;
  return 0; 
}

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

using namespace std;

int main()
{
    int A,B,X;
    scanf("%d %d %d",&A,&B,&X);
    if(1<=A<=100&&1<=B<=100&&1<=X<=200){
            for(int i=0;i<=B&&X>A;i++){
               B--;
               A++;

            }
            if(A==X){
                printf("YES");
            }
            else{
                printf("NO");
            }
    }
    return 0;
}


Measured memory_bytes: 256
import Control.Applicative
import Data.List (foldl')

data Dice = Dice [Int] deriving (Show)

roll :: Dice -> Char -> Dice
roll (Dice [top, front, right, left, back, bottom]) 'N' = Dice [front, bottom, right, left, top, back]
roll (Dice [top, front, right, left, back, bottom]) 'S' = Dice [back, top, right, left, bottom, front]
roll (Dice [top, front, right, left, back, bottom]) 'E' = Dice [left, front, top, bottom, back, right]
roll (Dice [top, front, right, left, back, bottom]) 'W' = Dice [right, front, bottom, top, back, left]

getTop :: Dice -> Int
getTop (Dice (x:_)) = x

main = do
    xs <- map read . words <$> getLine
    getLine >>= print . getTop . foldl' roll (Dice xs)


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

ll N, DP[200001]={0}, ans=0;
map<pair<ll, ll>, ll> M;
signed main(){
    cin >> N;
    for(int i=1;i<=N;i++) {
        if(i%10==0) continue;
        int a = log10(i);
        int topd = i/pow(10,a);
        int botd = i%10;
        pair<ll, ll> p = make_pair(topd, botd);
        M[p]++;
    }
    for(int i=1;i<=N;i++) {
        if(i%10==0) continue;
        int a = log10(i);
        int topd = i/pow(10,a);
        int botd = i%10;
        pair<ll, ll> p = make_pair(botd, topd);
        ans += M[p];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
using System;
using System.Collections.Generic;

class Program
{
    static string s = Console.ReadLine();
    static List<int> list = new List<int>();

    static void Main()
    {
        Dfs("");
        int n = int.Parse(s);
        list.Sort();
        for (int i = list.Count - 1; i >= 0; i--)
        {
            if (list[i] > n) list.RemoveAt(i);
            else break;
        }

        Console.WriteLine(list.Count);
    }

    static void Dfs(string x)
    {
        if (Check(x)) list.Add(int.Parse(x));
        if (x.Length < s.Length)
        {
            Dfs(x + '3');
            Dfs(x + '5');
            Dfs(x + '7');
        }
    }

    static bool Check(string t)
    {
        bool[] sign = new bool[3];
        for (int i = 0; i < t.Length; i++)
        {
            switch (t[i])
            {
                case '7':
                    sign[0] = true;
                    break;
                case '5':
                    sign[1] = true;
                    break;
                case '3':
                    sign[2] = true;
                    break;
                default:
                    return false;
                    break;
            }
        }
        if (sign[0] == true && sign[1] == true && sign[2] == true)
            return true;
        else return false;
    }
}

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

#define INIT std::cin.tie(0);std::ios::sync_with_stdio(false);
#define ALL(c) (c).begin(), (c).end()
#define CALL(c) (c).cbegin(), (c).cend()
#define RALL(c) (c).rbegin(), (c).rend()
#define CRALL(c) (c).crbegin(), (c).crend()
#define REP(i, n) for (int i = 0; i < static_cast<int>(n); i++)
#define FOR(i, s, n) for (int i = s; i < static_cast<int>(n); i++)
#define ASC(t) [](t& x, t& y){ return x < y; }
#define DESC(t) [](t& x, t& y){ return x > y; }
#define PSORT(s,p,e) partial_sort((s), next((s), (p)), (e))
#define VIEW(v,t) for_each((v).begin(), (v).end(), [](t& a) { cout << a << " "; }); cout << endl;

#define IN(a, x, b) (a<=x && x<b)
template<class T> inline T CHMAX(T& x, const T y){return x=(x<y)?y:x;}
template<class T> inline T CHMIN(T& x, const T y){return x=(x>y)?y:x;}
#define OUT(dist) std::cout<<(dist);
#define WS std::cout<<" ";
#define NL std::cout<<"\n"

using PII = pair<int, int>;
using PLL = pair<long long, long long>;
using LL = long long;
using ULL = unsigned long long;
template<class T> using V = vector<T>;
template<class T> using V2 = vector<vector<T>>;
template<class T, int W=255> using A = array<T, W>;
template<class T, int W=255, int H=255> using A2 = array<array<T, W>, W>;

int a,b,t;

int main(){
    INIT;
    cin >> a; cin >> b; cin >> t;
    int ans = (t/a) * b;
    cout << ans << "\n";
}

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

int main()
{
    int N;
    scanf("%d", &N);
    char S[15];
    int res = 0;
    int A = 0, B = 0, BA = 0;
    for(int i = 0; i < N; ++i) {
        scanf("%s", S);
        int len = strlen(S);
        bool Bh = S[0] == 'B';
        bool At = S[len-1] == 'A';
        if(Bh && !At) ++B;
        if(!Bh && At) ++A;
        if(Bh && At) ++BA;
        for(int i = 0; i < len-1; ++i) {
            if(S[i] == 'A' && S[i+1] == 'B') ++res;
        }
    }

    if(BA == 0) { printf("%d\n", res + min(A, B));  return 0;}
    res += (BA-1);
    if(A >= 1) res += 1, --A;
    if(B >= 1) res += 1, --B;
    res += min(A, B);
    printf("%d\n", res);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ii pair<int,int>
#define F first
#define S second
#define pb push_back
#define pf push_front
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a) for(int i = a; i >= 0; i--)
#define fori(i,m) for(auto i = m.begin(); i != m.end(); i++) 
#define sz(s) int(s.size())
#define cls(a,car) memset(a,car,sizeof (a))
using namespace std;
typedef long long ll;
typedef vector<int> vi;
const int N = 1 * 1e5 + 5;
const ll mod = 1e9 + 7;
const int INF = INT_MAX;
const ll INFCAD  = ll(INT_MAX) * 2 + 1;
const double E = 1e-9;
int main(){
    //freopen("in","r",stdin);
    //freopen("out","w",stdout);
    int n,m;
    cin >> n >> m;
    vector<int> G[n + 1];
    while(m--){
        int x,y;
        cin >> x >> y;
        x--;y--;
        G[x].pb(y);
        G[y].pb(x);
    }
    fore(i,0,n)
        cout << sz(G[i]) << '\n';
    return 0;
}   

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e14;
const int ZERO = 0;
const int MOD = 1000000007;
const double PI = 3.14159265359;
typedef pair<int,int> P;

signed main() {
    int N;
    cin >> N;
    vector<int> vec(N);
    for(int i = 0;i < N;i++) {
        cin >> vec.at(i);
    }
    int cnt = 0;
    int cnt2 = 0;
    for(int i = 0;i < N;i++) {
        cnt += vec.at(i);
    }
    int ret = INF;
    for(int i = 0;i < N;i++) {
        cnt2 += vec.at(i);
        cnt -= vec.at(i);
        ret = min(ret,abs(cnt2 - cnt));
    }
    cout << ret << endl;
}

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

int main()
{
  i64 n;
  cin >> n;
  set<i64> a;
  for (i64 i = 0; i < n; i++)
  {
    i64 t;
    cin >> t;
    a.insert(t);
  }
  if (a.size() == n)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}


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

void Solve()
{
    int H, W;
    cin >> H >> W;
    int S[H + 1][W + 1];
    char s;
    for (int i = 1; i < H + 1; i++)
    {
        for (int j = 1; j < W + 1; j++)
        {
            cin >> s;
            if (s == '#')
            {
                S[i][j] = 0;
            }
            else
            {
                S[i][j] = 1;
            }
        }
    }
    int L[H + 2][W + 2], R[H + 2][W + 2];
    for (int i = 1; i < H + 1; i++)
    {
        L[i][0] = 0;
        R[i][W + 1] = 0;
        for (int j = 1; j < W + 1; j++)
        {

            L[i][j] = S[i][j];
            if (S[i][j] == 0)
            {
                L[i][j] = 0;
            }
            else
            {
                L[i][j] += L[i][j - 1];
            }
            R[i][W + 1 - j] = S[i][W + 1 - j];
            if (S[i][W + 1 - j] == 0)
            {
                R[i][W + 1 - j] = 0;
            }
            else
            {
                R[i][W + 1 - j] += R[i][W + 2 - j];
            }
        }
    }
    int U[H + 2][W + 2], D[H + 2][W + 2];
    for (int j = 1; j < W + 1; j++)
    {
        U[0][j] = 0;
        D[H + 1][j] = 0;
        for (int i = 1; i < H + 1; i++)
        {

            U[i][j] = S[i][j];
            if (S[i][j] == 0)
            {
                U[i][j] = 0;
            }
            else
            {
                U[i][j] += U[i - 1][j];
            }
            D[H + 1 - i][j] = S[H + 1 - i][j];
            if (S[H + 1 - i][j] == 0)
            {
                D[H + 1 - i][j] = 0;
            }
            else
            {
                D[H + 1 - i][j] += D[H + 2 - i][j];
            }
        }
    }
    int ans = 0;
    int val;
    for (int i = 1; i < H + 1; i++)
    {
        for (int j = 1; j < W + 1; j++)
        {
            val = R[i][j] + L[i][j] + U[i][j] + D[i][j] - 3;
            ans = max(ans, val);
        }
    }
    cout << ans << endl;
}

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

Measured memory_bytes: 78464
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll INF = 1e18;


int main()
{
ll k,n,min=-1*INF;
cin>>k>>n;
ll a[n];
cin>>a[0];
for(ll i=1;i<n;i++)
{
    cin>>a[i];
    if((a[i]-a[i-1])>min)
    {
        min=a[i]-a[i-1];
    }
}
if((k-a[n-1]+a[0])>min){
    min=k-a[n-1]+a[0];
}
cout<<k-min;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <unordered_map>
#include <iterator>
#include <stack>
#include <unordered_set>
#include <iomanip>
#include <ctime>
#include <cstring>
#include <bitset>

#include <random>
#define all(x) (x).begin(), (x).end()


using namespace std;
void dout() { cerr << endl; }
typedef long long ll;
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

#define debug(x) cout << #x " = " << (x) << endl

using ll = long long;
using pii = pair<ll, ll>;
using ld = long double;
using pll = pair<long long, long long>;

template <typename T>
void do_uniq(vector<T> vec){
    sort(all(vec));
    vec.resize(unique(all(vec)) - vec.begin());
}

#define solvsh
//#define multi
#ifdef solvsh

const int MAXN = 2e5 + 100;


ll gcd(ll x, ll y){
    return y ? gcd(y, x % y) : x;
}

void solve() {
    ll k;
    cin >> k;

    ll answr = 0;
    for (int a = 1; a <= k; ++a) {
        for (int b = 1; b <= k; ++b) {
            for (int c = 1; c <= k; ++c) {
                answr += gcd(a, gcd(b, c));
            }
        }
    }
    cout << answr;
}

#else

#endif

void multisolve() {
    int t;
    cin >> t;

    int i = 1;
    while (t--) {
        cout << "Case #" << (i++)  << ":} ";
        solve();
        cout << endl;
    }
}


#define int int
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    cout << fixed << setprecision(20);


#ifdef multi
    multisolve();
#else
    solve();
//    gen();
#endif

}

Measured memory_bytes: 3616
def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors += [i, n // i]            
    divisors.sort()
    return divisors


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

ans = 0
for i in range(a, b + 1):
    if i in div_A:
        ans += 1
print(ans)


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

class Program{

  static double ans;
  static double work;
  static int a, b, t;

  static int Main() {

    string[] nyu = Console.ReadLine().Split(' ');
    a = int.Parse(nyu[0]);
    b = int.Parse(nyu[1]);
    t = int.Parse(nyu[2]);

    // ここまで入力

    work = (t + 0.5)/a;
    ans = (int)work * b;

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

    return 0;
  }

}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;  // vi <=> vl
using vb = vector<bool>;
using boolGraph = vector<vb>;
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const double EPS = 1e-9;

int main() {
  int n; cin >> n;
  vi arr(n+2);  // 1-indexed
  rep(i,n) cin >> arr[i+1];

  vi cost(n+1);
  rep(i,n+1) cost[i] = abs(arr[i+1] - arr[i]);
  int original = accumulate(all(cost), 0);

  rep(i,n) {
    int ans = original - cost[i] - cost[i+1] + abs(arr[i] - arr[i+2]);
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define INF 100000000
using namespace std;
const int mod = 1000000007;

int main() {

    int64_t N, ans = 0, b = 0;
    string A;
    cin >> N >> A;
    vector<int> R(0), G(0);
    unordered_map<int,int> B;
    for (int i = 1; i <= N; i++) {
        if (A[i - 1] == 'R')R.push_back(i);
        if (A[i - 1] == 'G')G.push_back(i);
        if (A[i - 1] == 'B') {
            B[i] = 1; b++;
           //if (!B.count(i)) { B[i] = 1; b++; }
           //else { B[i]++; b++; }
        }
    }
    int out = 0;
        for (int i = 0; i < R.size(); i++) {
            for (int j = 0; j < G.size(); j++) {
                int grb = G[j] + G[j] - R[i];
                int rgb = R[i] + R[i] - G[j];
                int gbr= (R[i] + G[j]) / 2;
                if ((R[i] + G[j]) % 2 != 0) {
                    gbr = INF;
                }
                if (B.count(grb))out++;
                if (B.count(rgb))out++;
                if (B.count(gbr))out++;
                ans += b;
                ans -= out;
                out = 0;
            }
        }
        //vector<vector<int>> A(N,vector<int>(M));
        //for(int i=0; i<N; i++){for(int j=0; j<M; j++){cin>>A[i][j];}}
        //sort(A.begin(),A.end());
        //for (int i = 0; i < N; i++) { maximum = max(maximum , A[i]);}
        //for (int i = 0; i < N; i++) { minimum = min(minimum , A[i]);}
        cout << ans << endl;
    }



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

public class Main {
	private static void solve(){
	//Implement solution here.
		int a = ni();
		int b = ni();
		int k = ni();
		int d = Math.min(a,b);
		for(int i = 0; i < k; i++){
			while(true){
				if(a % d == 0 && b % d == 0){
					if(i == k - 1){
						System.out.println(d);
						return;
					}
					d--;
					break;
				}
				d--;
			}
		}
	}

    //Switch input source (stdin/file)
	private static Scanner scanner = new Scanner(System.in);
	public static void main(String[] args){
        String debugDataPath = System.getenv("DD_PATH");        
        if(debugDataPath != null){
            try{
                scanner = new Scanner(new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath)))));
            }catch(Exception e){
                throw new RuntimeException(e);
            }
        }
        solve();
	}

    //Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(scanner.nextLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
    //Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
    //Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
    //Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
    //Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
    //Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

Measured memory_bytes: 23252
#!/usr/bin/perl
#abc84_c.pl
#Sun Jan  7 18:53:35 2018
#

use warnings;
use strict;

my @c;
my @s;
my @f;

my $n = <STDIN>;
chomp $n;

my $loopnum = $n-1;

while ($loopnum > 0){
	my $stdin = <STDIN>;
	chomp $stdin;
	my @temp = split(" ",$stdin);
	push (@c, $temp[0]);
	push (@s, $temp[1]);
	push (@f, $temp[2]);
	$loopnum--;
}

my @answers;

while ($loopnum <= $n-2){
	my $answer = 0;
	my $subloop = $loopnum;
	while ($subloop <= $#c){
		if ($answer < $s[$subloop]){
			$answer = $s[$subloop] + $c[$subloop];
		}elsif($answer%$f[$subloop] > 0){
			$answer = $answer + $f[$subloop] - $answer%$f[$subloop] + $c[$subloop];
		}else{
			$answer = $answer + $c[$subloop];
		}
		$subloop++;
	}
	push (@answers, $answer);
	$loopnum++;
}

foreach (@answers){
	print $_,"\n";
}
print "0\n";

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

int INF = (1LL<<31) - 1;

const int depth = 17;
class Segtree {
public:
	int data[1<<(depth+1)];
	Segtree() { for (int i = 0; i < (1<<(depth+1)); i++) data[i] = INF; }
	void update(int pos, int x) {
		pos = (1 << depth) - 1 + pos;
		data[pos] = x;
		while (pos > 0) {
			pos = (pos - 1) / 2;
			data[pos] = min(data[pos * 2 + 1], data[pos * 2 + 2]);
		}
	}
	//[l, r)???????°????????±???????. data[id]?????????[a, b)???????°?????????????.
	int minVal(int l, int r, int a = 0, int b = (1 << depth), int id = 0) {
		if (b <= l || a >= r) return INF;
		if (l <= a && b <= r) return data[id];
		
		int u = minVal(l, r, a, a + (b - a) / 2, id * 2 + 1);
		int v = minVal(l, r, a + (b - a) / 2, b, id * 2 + 2);
		return min(u, v);
	}
};

Segtree seg;
int n, q;
int com, x, y;

int main() {
	cin >> n >> q;
	for (int i = 0; i < q; i++) {
		cin >> com >> x >> y;
		if (com == 0) { seg.update(x, y); }
		else { cout << seg.minVal(x, y + 1) << endl; }
	}
	return 0;
}

Measured memory_bytes: 4120