akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int a;
    string s;
    cin >> a;
    cin >> s;
    if (a >= 3200)
    {
        cout << s << endl;
    }
    else
    {
        cout << "red" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
// 問題の URL を書いておく
// 

#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>

using namespace std;

//#define ENABLE_PRINT

#if defined(ENABLE_PRINT)

#define Print(v) \
do {\
    cout << #v << ": " << v << endl; \
}while(0)

#define PrintVec(v) \
do {\
    for(int __i = 0; __i < v.size(); ++__i) \
    { \
        cout << #v << "[" << __i << "]: " << v[__i] << endl; \
    }\
}while(0)

#else

#define Print(v) ((void)0)
#define PrintVec(v) ((void)0)

#endif

#define rep(i, n) for(int i = 0; i < (int)(n); ++i)

using ll = int64_t;

const int M = 1000000007;
#if 0
int main(int, const char**)
{
    map<char, int> counts;
    int n;
    cin >> n;
    int ans = 1;
    string s;
    cin >> s;
    for(auto c : s)
    {
        if(counts.find(c) == counts.end())
        {
            counts[c] = 0;
        }
        counts[c]++;
    }

    for(auto c : counts)
    {
        ans *= c.second;
        ans %= M;
    }
    cout << ans << endl;

    return 0;
}
#else
int main(int, const char**)
{
    set<char> dup;
    int n;
    cin >> n;
    int prev = 0;
    int ans = 0;
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    for(auto c : s)
    {
        if(dup.find(c) == dup.end())
        {
            prev = ans;
            ans = ans * 2 % M + 1;
            ans %= M;
            dup.insert(c);
        }
        else
        {
            ans = (ans + prev + 1) % M;
        }
    }
    cout << ans << endl;

    return 0;
}
#endif

Measured memory_bytes: 3732
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

fn main(){

    input!{
        n: usize,
    }

    let range = ((n as f64).sqrt().ceil()) as usize;
    let mut cnt = 0;
    let mut ans: Vec<usize> = vec![0;10001];
    //for i in 1..n+1 {
        for x in 1..range+1 {
            for y in x..range+1{
                for z in y..range+1 {
                    let v =  x*x+y*y+z*z+x*y+y*z+z*x;
                    if v < 10001 {
                        if x==y && y==z && z==x{
                            ans[v] += 1;
                        } else if x!=y && y!=z && z!=x {
                            ans[v] += 6;
                        } else {
                            ans[v] += 3;
                        }
                    }
                }
            }
        }
        //println!("{}", cnt);
        //cnt = 0;
    //}

    for i in 1..n+1 {
        println!("{}", ans[i]);
    }
}

Measured memory_bytes: 2684
#include<bits/stdc++.h>
using namespace std;
int N,M,Q;
int sum[501][501]={0};
void buildsumtable(vector<int> L,vector<int> R){
    for(int i=0;i<M;i++){
        sum[L[i]][R[i]]++;
    }
    for(int i=1;i<=N;i++){
        for(int j=1;j<=N;j++){
            sum[i][j]+=sum[i-1][j];
            sum[i][j]+=sum[i][j-1];
            sum[i][j]-=sum[i-1][j-1];
        }
    }
}
int ansrange(int p,int q){
    return sum[q][q]-sum[p-1][q]-sum[q][p-1]+sum[p-1][p-1];
}
int main(){
    cin>>N>>M>>Q;
    vector<int> L(M);
    vector<int> R(M);
    for(int i=0;i<M;i++){
        cin>>L[i]>>R[i];
    }
    vector<int> p(Q);
    vector<int> q(Q);
    for(int i=0;i<Q;i++){
        cin>>p[i]>>q[i];
    }
    buildsumtable(L,R);
    for(int i=0;i<Q;i++){
        cout<<ansrange(p[i],q[i])<<endl;
    }
    return 0;
}


Measured memory_bytes: 5120
package main

import (
	"fmt"
)

func main() {
	var n int
	var m string
	var counter = make([]int, 4)
	fmt.Scanln(&n)
	for i := 0; i < n; i++ {
		fmt.Scanln(&m)
		switch m {
		case "AC":
			counter[0]++
		case "WA":
			counter[1]++
		case "TLE":
			counter[2]++
		case "RE":
			counter[3]++
		}
	}
	fmt.Printf("AC x %d\n", counter[0])
	fmt.Printf("WA x %d\n", counter[1])
	fmt.Printf("TLE x %d\n", counter[2])
	fmt.Printf("RE x %d\n", counter[3])
}

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

int main(){
  int a, b;
  while(cin >> a >> b, a | b){
    char ans = 'A';
    int m = a + b;
    for(int i = 1;i < 5;i++){
      cin >> a >> b;
      if(a + b > m){
	ans = i + 'A';
	m = a + b;
      }
    }
    cout << ans << " " << m << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>

using namespace std;

int main() {
    
    int a,b,C;
    cin >> a >> b >> C;
    double S,L,h;
    h = b * sin(2 * M_PI / 360 * C);
    S = h * a / 2;
    double d = a - b * cos(2 * M_PI / 360 * C);
    L = a + b + sqrt(pow(h,2) + pow(d,2));
    cout << fixed << setprecision(4) << S << endl;
    cout << fixed << setprecision(4) << L << endl;
    cout << fixed << setprecision(4) << h << endl;
}



Measured memory_bytes: 3496
#include <bits/stdc++.h>
#define MOD 1e9 + 7
#define PI 3.141592653589793238
#define pb push_back
#define ALL(V) (V).begin(), (V).end()
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long int lint;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<int> VI;
typedef pair<ll, ll> P;
ll gcd(ll a, ll b) { return (a % b == 0 ? b : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll char_to_ll(char c) { return (int)(c - '0'); }
ll string_to_ll(string s) { return char_to_ll(atoi(s.c_str())); }
bool is_prime(ll x){ if(x <= 1) return false; for(ll i = 2; sqrt(i) <= x; i++) if(x % i == 0) return false; return true; }


int main() {
    int a,b,c;
    cin >> a >> b >> c;

    swap(a, b);
    swap(a, c);

    cout << a << " " << b << " "<< c << endl;


    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
void rd(char c[]){
  int i, sz=0;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c[sz++] = i;
  for(;;){
    i = getchar_unlocked();
    if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF){
      break;
    }
    c[sz++] = i;
  }
  c[sz]='\0';
}
template<class S, class T> inline void chmin(S &a, T b){
  if(a>b){
    a=b;
  }
}
int main(){
  char S[55];
  int N, hist[26], i, j, len, res[26];
  {
    int Lj4PdHRW;
    for(Lj4PdHRW= 0;Lj4PdHRW< (25) + 1;Lj4PdHRW++){
      res[Lj4PdHRW] = 100;
    }
  }
  rd(N);
  while(N--){
    rd(S);
    len = strlen(S);
    {
      int KL2GvlyY;
      for(KL2GvlyY= 0;KL2GvlyY< (len-1) + 1;KL2GvlyY++){
        S[KL2GvlyY] -= 'a';
      }
    }
    {
      int Q5VJL1cS;
      for(Q5VJL1cS= 0;Q5VJL1cS< (25) + 1;Q5VJL1cS++){
        hist[Q5VJL1cS] = 0;
      }
    }
    {
      int e98WHCEY;
      for(e98WHCEY= 0;e98WHCEY< (len-1) + 1;e98WHCEY++){
        hist[S[e98WHCEY]]++;
      }
    }
    {
      int cTE1_r3A;
      for(cTE1_r3A= 0;cTE1_r3A< (25) + 1;cTE1_r3A++){
        chmin(res[cTE1_r3A], hist[cTE1_r3A]);
      }
    }
  }
  for(i=0;i<26;i++){
    for(j=0;j<res[i];j++){
      putchar_unlocked('a'+i);
    }
  }
  putchar_unlocked('\n');
  return 0;
}
// cLay varsion 20170408-3 [beta]

// --- original code ---
// {
//   int N;
//   char S[55];
//   
//   int res[26], hist[26];
//   int i, j, len;
// 
//   res[0..25] = 100;
//   rd(N);
//   while(N--){
//     rd(S);
//     len = strlen(S);
//     S[0..len-1] -= 'a';
//     hist[0..25] = 0;
//     hist[S[0..len-1]]++;
//     res[0..25] <?= hist[0..];
//   }
//   
// 
//   rep(i,26) rep(j,res[i]) putchar_unlocked('a'+i);
//   putchar_unlocked('\n');
// }


Measured memory_bytes: 256
import itertools
A = list(map(int, input().split()))
s = sum(A)
A.sort()
for k in range(len(A)):
    li = list(itertools.combinations(A, k+1))
    for j in range(len(li)):
        if 2 * sum(li[j]) == s:
            print("Yes")
            break
    else:
        continue
    break
else:
    print("No")

Measured memory_bytes: 3064
N,L = map(int,input().split())

ref = 0
for i in range(N):
    ref += L+i
th = 2 ** 30  - 1
for i in range(N):
    tmp = 0
    for j in range(N):
        if i == j:continue
        tmp += L + j
    
    if abs(tmp - ref) < th:
        ans = tmp
        th = abs(tmp-ref)
        
print(ans)
        
    

Measured memory_bytes: 3060
# coding: utf-8
from collections import defaultdict, deque


def popcount(x):
    assert x.bit_length() <= 32
    x -= (x >> 1) & 0x55555555
    x = (x & 0x33333333) + ((x >> 2) & 0x33333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f
    x += x >> 8
    x += x >> 16
    return x & 0x3f


def solve(*args: str) -> str:
    n = int(args[0])
    x = args[1]

    ret = []
    dp = defaultdict(int)
    x_count = x.count('1')
    x_dec = int(x, 2)

    x_mod_set = x_dec % (x_count+1)
    xor_set = 1 % (x_count+1)
    if 1 < x_count:
        x_mod_reset = x_dec % (x_count-1)
        xor_reset = 1 % (x_count-1)

    for i in range(n):
        bitcount = x_count + (1 if x[-1-i] == '0' else -1)
        if bitcount == 0:
            ret.append(str(0))
            continue

        m = (x_mod_set + xor_set
             if x[-1-i] == '0' else
             x_mod_reset - xor_reset) % bitcount
        deq = deque([m])

        count = 1
        while m:
            deq.append(m)
            if 0 < dp[m]:
                count += dp[m]
                break

            m = m % popcount(m)
            count += 1

        ret.append(str(count))

        while deq:
            dp[deq.popleft()] = count
            count -= 1

        xor_set = (xor_set << 1) % (x_count+1)
        if 1 < x_count:
            xor_reset = (xor_reset << 1) % (x_count-1)

    return '\n'.join(ret[::-1])


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))


Measured memory_bytes: 26872
import std.stdio, std.conv, std.string, std.algorithm, std.array, std.range;

void dump(long[][] arr) {
  for(int i = 0; i < arr.length; i++)
    for(int j = 0; j < arr[i].length; j++)
      writef("%2d%s", arr[i][j], j == arr[i].length - 1 ? "\n" : " ");
  writeln;
}

void main() {
  int t = readln.chomp.to!(int);
  long ans = long.min;
  long[101][101] arr;
  long[101][101] dp;
  long region[4];
  for(int i = 0; i < t; i++) {
    long[] data = (readln.chomp.split(" ").map!(to!(long)).array) ~ [0L];
    for(int j = 0; j <= t; j++) {
      arr[i][j] = data[j];
    }
  }
  for(int i = 0; i <= t; i++)
    arr[i][t] = 0;
  
  for(int i = t - 1; i >= 0; i--) {
    for (int j = t - 1; j >= 0; j--) {
      dp[i][j] += arr[i][j] + dp[i + 1][j] + dp[i][j + 1] - dp[i + 1][j + 1];
    }
  }
  for(int i = t; i >= 0; i--) {
    for(int j = t; j >= 0; j--) {
      for(int n = i + 1; n <= t; n++) {
        for(int m = j + 1; m <= t; m++) {
          long v = dp[i][j] - dp[n][j] - dp[i][m] + dp[n][m];
          if (ans < v) {            
            ans = v;
            region = [i, j, n - 1, m - 1];
          }
        }
      }
    }
  }
  // dump(dp);
  // writeln(region);
  writeln(ans);
}

Measured memory_bytes: 1780
n, d = map(int, input().split())
xy = [map(int, input().split()) for _ in range(n)]
x, y = [list(i) for i in zip(*xy)]
ans = 0
for i in range(n):
    xy = x[i]**2 + y[i]**2
    if xy <= d**2:
        ans += 1
print(ans)

Measured memory_bytes: 116608
#include <bits/stdc++.h>
using namespace std;
typedef int int__;
#define int long long
#define pb push_back
#define pi pair<int,int>
#define vpi vector<pi>
#define vi vector<int>
#define vvi vector<vi>
#define fi first
#define se second
#define forn(i, n)for(int i=0;i<int__(n);i++) 
#define sz(a)int__(a.size())
template <class A, class B> ostream& operator << (ostream& out, const pair<A, B> &a){return out << "(" << a.first << ", " << a.second << ")";}
template<class A>ostream& operator<<(ostream& out,const vector<A>&v){out<<"[";forn(i,sz(v)){if(i)out<<", ";out<<v[i];}return out<<"]";}
const int MAX = 1e9 + 100;
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
int Mod(int x){const int mm=2019;x%=mm;if(x<0)x+=mm;return x;}
int Pow(int x,int n){if(n==0)return 1;int t=Pow(x,n/2);t=Mod(t*t);if(n&1)t=Mod(t*x);return t;}
#define watch(x) cout << #x << " : " << x << endl;
int gcd(int a,int b){if(b==0)return a;return gcd(b,a%b);}
#define all(x) x.begin(), x.end()

int__ main() {
	fast;
	int ans = 0;
	int a,b,n; cin >> a >> b >> n;
	
	int i=min(b-1,n);
	int t = ((a*i)/b) - (a * (i/b));
	ans = max(ans,t);


	cout << ans << endl;
}

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

int main() {
    int N;
    cin >> N;
    string n;
    map<string,int> dic;

    for(int i = 0; i < N; i++){
        cin >> n;
        if(!dic.count(n)){
            dic[n] = 1;
        }
    }
    cout << dic.size() << endl;
    // for(auto i : dic){
    //     cout << i.first << endl;
    // }
}


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

int main(){
  long n,m,c=0;
  cin >> n >> m;
  if(m==1)
    c=0;
  else if(m<=2*n)
     c=m/2;
  else
    c=n+(m-2*n)/4;
  cout << c << endl;
}

Measured memory_bytes: 256
S = list(input().rstrip("\n"))
K = int(input())

# 全ての文字が同じとき
if S.count(S[0]) == len(S):
    answer = (len(S) * K) // 2
    print(answer)
    exit()

from itertools import groupby

# 初項(K=1)を求める
init = 0
for _,group in groupby(S):
    tmp = sum(1 for _ in group)
    if tmp >= 2:
        init += tmp // 2

if K == 1:
    print(init)
    exit()

# 公差を求める
com_diff = 0
for _ ,group in groupby(S+S):
    tmp = sum(1 for _ in group)
    if tmp >= 2:
        com_diff += tmp // 2
com_diff -= init

print(init + (K-1)*com_diff)

Measured memory_bytes: 3064
using System;

namespace ABC174
{
    class Program
    {
        static long Gcd(long a, long b)
        {
            long[] v = new long[] { a, b };
            while (v[1] != 0) { v = new long[] { v[1], v[0] % v[1] }; }
            return v[0];
        }
        static long Lcm(long a, long b)
        {
            return a / Gcd(a, b) * b;
        }
        class Node<T>
        {
            private int m_height;
            private Node<T> m_parent;
            public T Item { get; private set; }
            public Node(T item)
            {
                m_height = 0;
                m_parent = this;
                Item = item;
            }
            public Node<T> Find()
            {
                if (m_parent == this) { return this; }

                Node<T> parent = m_parent.Find();
                m_parent = parent;
                return parent;
            }
            public static void Unite(Node<T> a, Node<T> b)
            {
                Node<T> p = a.Find();
                Node<T> q = b.Find();
                if (p.m_height < q.m_height)
                {
                    p.m_parent = q;
                    q.m_height = Math.Max(p.m_height + 1, q.m_height);
                }
                else
                {
                    q.m_parent = p;
                    p.m_height = Math.Max(q.m_height + 1, p.m_height);
                }
            }
        }
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            string ans = "";
            if (a >= 30)
                ans = "Yes";
            else
                ans = "No";
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 27512
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)
#define rrep(i,j,n) for(ll i = (ll)(j); i < (ll)(n); i++)
#define mrep(i,n) for (ll i = (ll)(n); i > 0; i--)
#define be(v) (v).begin(), (v).end()
#define dcout cout << fixed << setprecision(20) 
ll INF = 1LL << 60;
ll mod = 1e9 + 7;

int main() {
	ll a,v,b,w,t;
	cin >> a >> v >> b >> w >> t;
	ll s=v-w;
	s*=t;
	if(s>=abs(b-a)) cout << "YES" << endl;
	else cout << "NO" << endl;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define ll long long
#define ull  unsigned long long
#define pb push_back

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int N = 6000;
const int K = 1000000000;
int dp[N][N], a[N], b[N];
bool p[N][N];
main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt","w", stdout);
    int x, y;
    cin >> x >> y;
    if (x % y == 0){
        cout << -1;
        return 0;
    }
    cout << x;
}


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

using namespace std;

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

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

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


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

	string a,b;
	cin >> a>>b;

	string t = a+b;

	rep(i,1000) {
		int n = i*i;
		string s = to_string(n);
		if(s == t) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" <<endl;

	return 0;
}



Measured memory_bytes: 256
import java.util.*;
import java.text.*;

class Main {
    public static void main(String[]args)throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int mx = Integer.MIN_VALUE;
        int mn = Integer.MAX_VALUE;
        long sum = 0;
        for(int i = 0; i < n; i++) {
            int a = sc.nextInt();
            if(a > mx) mx = a;
            if(a < mn) mn = a;
            sum += a;
        }
        System.out.println("" + mn + " " + mx + " " + sum);
    }
}

Measured memory_bytes: 31740
#!/usr/bin/env python3

import sys

if __name__ == '__main__':
	in_str = sys.stdin.readline()
	_a, _b = in_str.split(' ')
	a = int(_a )
	b = int(_b )
	area = a*b
	roun = a*2+b*2
	print('{} {}'.format( area, roun ))

Measured memory_bytes: 7656
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
long mod = (long) 1e9 + 7;

int main(){
    
    string s;
    cin >> s;
    
    int l = s.size(), rem = 0, ans = 0, k = 10;
    vector<int> v(2020,0);
    v[0] = 1;
    
    for(int i = l - 1; i >= 0; i--){
        int x = s[i] - '0';
        rem = (x * k + rem) % 2019;
        ans += v[rem];
        v[rem]++;
        k = k * 10 % 2019;
    }
    
    cout << ans << "\n";
    
    return 0;
}


Measured memory_bytes: 3464
def function(ary)
    tmp = []
    sum = []
    ary.length.times do |i|
        if ary[i] != 0 then
            tmp << ary[i]
        else
            if tmp.length > 0 then
                sum << tmp
            end
            tmp = []
        end
        if i == ary.length - 1 && tmp.length != 0 then
            sum << tmp
        end
    end
    sum
end

N = gets.chomp.to_i
h = gets.split(' ')
h = h.map{|x| x.to_i}

f = 1
count = 0
while f == 1 do
    t = function(h)
    if t.length == 0 then
        f = 0
        break
    end
    count += t.length
    h = h.map do |x|
        if x > 0 then
            x - 1
        else
            0
        end
    end
end

print count

Measured memory_bytes: 3836
N , K = map(int,input().split())
h = list(map(int,input().split()))

def dp(cost):
    for x in range(1,N):
        for k in range(max(x-K,0),x):
            cost[x] = min(cost[x] , cost[k] + abs( h[x] - h[k] ) )
        # cost[x] =  min( [ cost[k] + abs( h[x] - h[k] ) for k in range(max(x-K,0),x) ] ) 
    return 0

def solve():
    cost = [float('inf')] * N
    cost[0] = 0
    dp(cost)
    print(cost[N-1])
    return 0

if __name__ == "__main__":
    solve()


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

int main(){
    int n; cin>>n;
    int a[200010];
    for(int i=0;i<n;i++)cin>>a[i];
    ll ans1=0;
    ll sum=0;
    for(int i=0;i<n;i++){
        sum+=a[i];
        if(i&1){
            if(sum<=0){
                ans1+=1-sum;
                sum=1;
            }
        }else{
            if(sum>=0){
                ans1+=1+sum;
                sum=-1;
            }
        }
    }
    ll ans2=0;
    sum=0;
    for(int i=0;i<n;i++){
        sum+=a[i];
        if(i&1){
            if(sum>=0){
                ans2+=1+sum;
                sum=-1;
            }
        }else{
            if(sum<=0){
                ans2+=1-sum;
                sum=1;
            }
        }
    }
    cout<<min(ans1,ans2)<<endl;
}


Measured memory_bytes: 640
package main

import (
	"fmt"
)

// go run ./main.go < in

func main() {
	var people, sweets int
	fmt.Scan(&people, &sweets)

	haveData := make(map[int]bool)
	for i := 1; i <= people; i++ {
		haveData[i] = false
	}

	for i := 0; i < sweets; i++ {
		var sunukeNum int
		fmt.Scan(&sunukeNum)
		for j := 1; j <= sunukeNum; j++ {
			var sunukeID int
			fmt.Scan(&sunukeID)
			haveData[sunukeID] = true
		}
	}

	count := 0
	for _, v := range haveData {
		if !v {
			count++
		}
	}
	fmt.Println(count)
}

Measured memory_bytes: 2540
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
const int INF = 1e9 + 5;

ll pot(ll base, ll potencia) {
    ll tot = 1;
    for (int i = 0; i <= potencia - 1; i++) {
        //cout << tot << '\n';
        tot *= base;
    }
    return tot;
}

void printVector(vector<int> v) {
    for (auto x : v) {
        cout << x << ' ';
    }
    cout << '\n';
}

int main() {
    int h, n;
    cin >> h >> n;
    vector<int> dp(h + 1, INF);
    dp[0] = 0;
    //printVector(dp);
    while (n--) {
        int valor, custo;
        cin >> valor >> custo;
        for (int i = 0; i <= h; i++) {
            int j = min(h, i + valor);
            dp[j] = min(dp[j], dp[i] + custo);
        }
    }
    cout << dp[h] << '\n';
    return 0;
}

Measured memory_bytes: 3672
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;

//vector string deque break continue
#define forn(i, s, f) for (int i = (int)s; i < (int)f; i++)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define fs first
#define sc second
#define pf push_front
#define pb push_back
#define pop_f pop_front
#define pop_b pop_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()

template <typename T> istream& operator>>(istream& in, vector <T>& a) {for (auto& i : a) in >> i; return in;}
template <typename T> ostream& operator<<(ostream& out, vector <T>& a)  {for (auto& i : a) out << i << " "; return out;}
template <typename T, typename U> void chkmin(T& a, U b) {if (a > b) a = b;}
template <typename T, typename U> void chkmax(T& a, U b) {if (a < b) a = b;}

const int MOD = 1e9 + 7;

int bin_pow(int a, int p) {
    if (!p)
        return 1;
    if (p % 2)
        return (1LL * bin_pow(a, p - 1) * a) % MOD;
    int t = bin_pow(a, p / 2);
    return (1LL * t * t) % MOD;
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int n, k;
    cin >> n >> k;
    vector <int> dp(k + 1);
    for (int i = k; i >= 1; --i) {
        int cnt = k / i;
        dp[i] = bin_pow(cnt, n);
        for (int j = 2 * i; j <= k; j += i)
            dp[i] = (dp[i] - dp[j] + MOD) % MOD;
    }
    int ans = 0;
    forn (i, 1, k + 1)
        ans = (ans + 1LL * dp[i] * i) % MOD;
    cout << ans;
    return 0;
}

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

using namespace std;


int main(void){
    string s;
    char x;

    cin>>s;
    x=s[s.size()-1];

    if(x == '3' ){
        cout<<"bon"<<endl;
    }else if(x == '0' || x == '1' ||x == '6' ||x == '8' ){
        cout<<"pon"<<endl;
    }else{
        cout<<"hon"<<endl;
    }


    return 0;
}



Measured memory_bytes: 3596
#include <iostream>

using namespace std;

int main(void) {
    int w, h;
    
    while(1){
        cin >> h >> w;
        
        if(w == 0 && h == 0){
            break;
        }
        
        for(int i = 0;i < h; ++i){
            for(int j = 0;j < w; ++j){
                cout << "#";
            }
            cout << "\n";
        }
        cout << "\n";
    }
    return 0;
}

Measured memory_bytes: 1120
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<iostream>
using namespace std;

int a[205];
int b[205];

int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	for(int i=1;i<=n;i++){
		int s=0;
		while(a[i]%2==0){
			a[i]=a[i]/2;
			s++;
			b[i]=s;
		}
	}
	sort(b+1,b+n+1);
	printf("%d\n",b[1]);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

vector<vector<int>> sum(100000);

int main(){
    int h,w,d;
    cin>>h>>w>>d;
    int a[h][w];
    pair<int,int> p[h*w+1];
    rep(i,h){ 
        rep(j,w){
            cin>>a[i][j];
            p[a[i][j]]={i,j};
        }
    }

    //for(int i=1;i<=h*w;i++) cout<<p[i].first<<" "<<p[i].second<<endl; 
    
    for(int i=1;i<=d;i++){
        for(int j=i;j<=h*w;j+=d){
            if(j==i){
                if(i==d) sum[0].push_back(0);
                else sum[i].push_back(0);
            }
            else{
                int c=abs(p[j].first-p[j-d].first)+abs(p[j].second-p[j-d].second);
                if(i==d) sum[0].push_back(c+sum[0][(j-1)/d-1]);
                else sum[i].push_back(c+sum[i][j/d-1]);
            }
        }
    }

    
    int q;
    cin>>q;
    while(q--){
        int l,r;
        cin>>l>>r;
        int x=l%d;
        int ans;
        if(x==0){
            if(l==d) ans=sum[x][(r-1)/d];
            else ans=sum[x][(r-1)/d]-sum[x][(l-1)/d];

        }
        else{
            if(l==x) ans=sum[x][r/d];
            else ans=sum[x][r/d]-sum[x][l/d];
        }
        

        cout<<ans<<endl;
    }    
}




Measured memory_bytes: 6656
#include <iostream>
#include <vector>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <bits/stdc++.h>

using namespace std;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(long long i=(a),i##Len_=(b);i<i##Len_;i++)
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;

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

    res = 0;

    FOR(i,1,N+1)
    {
        ll tmp = i;
        ll kai = 0;
        while(tmp / 10 != 0)
        {
            ++kai;
            tmp /= 10;
        }
        if(kai % 2 == 0)
        {
            ++res; 
        }
    }

    cout << res <<endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL)
int main()
{

#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  ll a;
  cin >> a;
  cout << a + pow(a, 2) + pow(a, 3) << endl;
}


Measured memory_bytes: 4148
{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
import           Control.Monad         (replicateM)
import           Control.Monad.ST
import           Control.Monad.State
import           Data.Array.MArray
import           Data.Array.ST
import qualified Data.ByteString.Char8 as BC
import           Data.Maybe            (fromJust)

main :: IO ()
main = do
  [h, w] <- getInts
  ass <- replicateM h getInts
  let (n, yxs) = solve h w ass
  print n
  putStr . unlines
    $ map (\(y, x, y', x') -> unwords [show y, show x, show y', show x']) yxs


solve :: Int -> Int -> [[Int]] -> (Int, [(Int, Int, Int, Int)])
solve h w ass = runST $ flip execStateT (0, []) $ do
  arr <- lift $ (newListArray ((1, 1), (h, w)) $ concat ass
    :: ST s (STUArray s (Int, Int) Int))
  let
    yxs = [(i, j) | i <- [1 .. h]
                  , j <- if odd i then [1 .. w] else reverse [1 .. w]]
  forM_ (zip yxs (tail yxs)) $ \(yx, yx') -> do
    a <- lift $ readArray arr yx
    a' <- lift $ readArray arr yx'
    when (odd a) $ do
      lift $ writeArray arr yx (a - 1)
      lift $ writeArray arr yx' (a' + 1)
      let yxyx' = (fst yx, snd yx, fst yx', snd yx')
      modify (\(n, yxyxs') -> (n + 1, yxyx':yxyxs'))
  modify (\(n, yxyxs') -> (n, reverse yxyxs'))

readInts :: BC.ByteString -> [Int]
readInts = map (fst . fromJust . BC.readInt) . BC.words

getInts :: IO [Int]
getInts = readInts <$> BC.getLine


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

main() {
    int K; cin >> K;
    if(K%2==0) cout << K/2*K/2 << endl;
    else cout << ((K+1)/2)*(K/2) << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int A=0,B=0,n,i,a,b;


  while(1){

    scanf("%d",&n);
    if(n==0) break;
    
    
    for(i=0;i<n;i++){
      scanf("%d %d",&a,&b);
      
      if(a==b){
	A+=a;
	B+=b;
      }
      
      else if(a>b){
	A+= a+b;
      }
      
      else{
	B+= a+b;
      }
      
    }
    
    printf("%d %d\n",A,B);

    A=0;
    B=0;
  }


  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
 
#define v vector
#define ll long long 
#define vpll vector<pair<long long,long long> > 
#define F first
#define S second
#define mp make_pair
#define lf long float
#define pb push_back
 
using namespace std; 
 
int main()
{
    ll k,x;
    cin>>k>>x;
    ll a = x-k+1;
    if(-1000000 > a)
    a = -1000000;
    ll b = x+k-1;
    if(b > 1000000)
    b = 1000000;
    for(ll i = a ; i <= b ; i++)
    cout<<i<<" ";
	return 0;
}

Measured memory_bytes: 256
/*BISMILLAHIR RAHMANIR RAHIM*/
#include <bits/stdc++.h>
using namespace std;
#define ll              long long
#define pb              push_back
#define all(x)          x.begin(), x.end()
#define all(y)          y.begin(), y.end()
#define all(z)          z.begin(), z.end()
#define pi              acos(-1.0)

int main()
{
    string s1, s2;
    getline(cin, s1);
    getline(cin, s2);
    int op = 0, len = s1.size();
    for(int i = 0; i < len; i++)
    {
        if(s1[i] == s2[i])
        {
            continue;
        }
        else op++;
    }
    cout << op << endl;
}
/*ALHAMDULILLAH*/


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

typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<string>vst;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef map<int,int> dct;

#define fastio ios_base::sync_with_stdio(false);cin.tie(0)
#define all(ct) ct.begin() , ct.end()
#define endl "\n"
#define fr(i,a) for(auto i:a)
#define f(i,a,b) for(int i=a;i<b;++i)
#define fd(i,a,b) for(int i=a;i>=b;--i)
#define pb push_back
#define in(d,v) d.find(v)!=d.end()
#define mp make_pair
#define pi 3.14159265

bool compare(pll a, pll b){
    return (a.first*b.second) < (a.second*b.first);
}

const int mod = 1e9 + 7;
const ll inf = ll(1e18);

ll modexp(ll x,ll n){
    if(n==0)return 1;
    if(n%2==0)return modexp((x*x)%mod,n/2);
    return (x*modexp((x*x)%mod,n/2))%mod;
}
vvi dp(1001,vi(100,-1));
bool calc(int d,int x){
    if(dp[d][x]!=-1)return dp[d][x];
    if(x<0)return dp[d][x]=false;
    if(x==0 and d==0)
        return dp[d][x]=true;
    if(d==0 and x>0)
        return dp[d][x]=false;
    f(i,0,6){
        if(calc(d-1,x-i))return dp[d][x]=true;
    }
    return dp[d][x]=false;
}
int main(){
    fastio;
    //clock_t tm = clock();
    int n;
    cin>>n;
    int d=n/100;
    int x=n%100;
    cout<<calc(d,x)<<endl;
    //cout<<((clock()-tm)*1.0)/CLOCKS_PER_SEC<<endl;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
#define MAX 200005
#define MOD 1000000007
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
#define si set<int>
#define mp map<ll,ll>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int main()
{ 
	fast 
	ll n,k,a[MAX],dp[MAX],i,j;
	cin>>n>>k;
	for(i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	dp[1]=0;
	for(i=2;i<=n;i++)
	{
		j=1;
		ll ans=1e12;
		while(i-j>0 && j<=k)
		{
			ans=min(ans,(dp[i-j]+abs(a[i]-a[i-j])));
			j++;
		}
		dp[i]=ans;
	}
	cout<<dp[n];


}

Measured memory_bytes: 3072
package main

import "fmt"

func main() {
	var minNum, lenNum, divide1, divide2 int
	fmt.Scanf("%d %d %d %d", &minNum, &lenNum, &divide1, &divide2)

	// f(x) = 1以上x以下の範囲でdivide1でもdivide2でも割り切れない数 としたとき、
	// f(lenNum) - f(minNum) でlenNum以上minNum以下の範囲をターゲットにできる
	// 注意！1以上minNum以下、minNum以上lenNum以下、とminNumが被ってるので、被らないように片方1つ範囲をずらす！
	fmt.Println(antiTotal(lenNum, divide1, divide2) - antiTotal(minNum-1, divide1, divide2))
}

// antiTotal は1以上lenNum以下の範囲でdivide1でもdivide2でも割り切れない数を求める関数
func antiTotal(lenNum int, divide1 int, divide2 int) int {
	var perfDivide1 int = lenNum / divide1
	var perfDivide2 int = lenNum / divide2
	var perfBoth int = lenNum / lcm(divide1, divide2)

	return lenNum - perfDivide1 - perfDivide2 + perfBoth
}

// lcm は最小公倍数を求める関数
func lcm(x int, y int) int {
	return (x * y) / gcd(x, y)
}

// gcd は最大公約数を求める関数
func gcd(x int, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}


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

int main() {
  string s;
  cin >> s;
  if (s == "Sunny") {
    cout << "Cloudy";
  } else if (s == "Cloudy") {
    cout << "Rainy";
  } else if (s == "Rainy") {
    cout << "Sunny";
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 768
A,B,C = map(int, input().split())
K = int(input())
count = 0
if B > A:
    pass
elif A >= B:
    while A >= B:
        B *= 2
        count += 1
if C > B:
    pass
elif B >= C:
    while B >= C:
        C *= 2
        count += 1
if K >= count:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9184
S = input()
Q = int(input())
T = 0
ins = ""
apd = ""
for i in range(Q):
    t = input()
    if t == "1":
        T = 1 - T
    else:
        _, F, C = t.split()
        F = int(F)
        if (T + F) % 2 == 0:
            apd += C
        else:
            ins += C
ans = ins[::-1] + S + apd
print(ans[::(-1)**T])


Measured memory_bytes: 4596
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <limits.h>
#include <bitset>
#define int long long
using namespace std;
using P = pair<int, int>;
using ll = long long;
using prique = priority_queue<int>;
const int MOD = 1000000007;
const int INF = LLONG_MAX/3;
const int MAX = 510000;
long long gcd(long long a,long long b){
    if(b==0)return a;
    return gcd(b,a%b);
}
signed main(){
    int n;
    cin>>n;
    int a[214514];
    for(int i=0;i<n;i++){
        cin>>a[i];
        a[i]-=i+1;
    }
    sort(a,a+n);
    int ans=INF;
    int rs=0,ls=0;
    for(int i=0;i<n;i++)rs+=a[i];
    for(int i=0;i<n;i++){
        rs-=a[i];
        int c=0;
        c+=rs-a[i]*(n-i-1);
        c+=abs(ls-a[i]*i);
        ls+=a[i];
        ans=min(ans,c);
        if(c==-15)cout<<i<<endl;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=605,mo=1e9+7;
int a[N],ty[N],n,cnt,_;
ll f[2][N][N];
void move(ll &a,ll b){
	a=(a+b)%mo;
}
int main(){
	cin>>n;
	for (int i=1;i<=2*n;i++)scanf("%d",&a[i]);
	for (int i=1;i<=2*n;i+=2){
		if (a[i]!=-1&&a[i+1]!=-1)
			ty[a[i]]=ty[a[i+1]]=3;
		else if (a[i]!=a[i+1])ty[a[i]^a[i+1]^-1]=1;
		else cnt++;
	}
	f[_=1][0][0]=1;
	for (int i=2*n;i>=1;i--){
		_^=1;
		memset(f[_],0,sizeof f[_]);
		for (int j=0;j<=2*n-i+1;j++)
		for (int k=0;j+k<=2*n-i+1;k++){
			if (ty[i]==1){
				if (j)move(f[_][j-1][k],f[!_][j][k]);
				move(f[_][j][k+1],f[!_][j][k]);
			}
			if (ty[i]==0){
				if (j)move(f[_][j-1][k],f[!_][j][k]);
				move(f[_][j+1][k],f[!_][j][k]);
				if (k)move(f[_][j][k-1],(ll)f[!_][j][k]*k);
			}
			if (ty[i]==3)
				move(f[_][j][k],f[!_][j][k]);
		}
	}
	ll ans=f[_][0][0];
	for (;cnt;cnt--)ans=ans*cnt%mo;
	cout<<ans<<endl;
}

Measured memory_bytes: 6016
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
	char s[102], t[102],tt[102];
	int a, l, i, j;
	while (cin >> s >> t)
	{
		strcpy( tt,s);
	     a=strcmp(s, t); l = strlen(s) - 1;
		if (a == 0) cout << "Yes" << endl;
		else {
			for (j = 0; j <= strlen(s) ; j++)
			{
				strcpy(tt, s);
				for (i = 0; i < strlen(s) - 1; i++)
				{
					s[i + 1] = tt[i];
				}
				s[0] = tt[l];
				a = strcmp(s, t);
				if (a == 0) { cout << "Yes" << endl; break; }
			}
		
			if (j == l + 2) cout << "No" << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());


int main(){
    string a,b,c;
    cin >> a >> b >>c;
    printf("%c%c%c\n",toupper(a[0]) ,toupper(b[0]),toupper(c[0]));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; 
   
int main(){
  int N,mod=1000000007;
  cin >> N;
  long long sum=0,ans=0;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
    sum+=A.at(i);
  }
  for(int i=0;i<N;i++){
    sum-=A.at(i);
    long long B=sum%mod;
    long long add=(B*A.at(i))%mod;
    ans=(ans+add)%mod;
  }
  cout << ans << endl;
}

Measured memory_bytes: 4032
#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <map>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <stack>
#include <queue>
#include <utility>
#include <bitset>
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
#define rep(i,a,b) for (int i=(a);i<(b);i++)
#define per(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,a,b) for (int i=(a);i<=(b);i++)
#define PER(i,a,b) for (int i=(b);i>=(a);i--)
#define de(x) cout<<">> "<<#x<<" = "<<x<<endl;
using namespace std;
typedef long long LL;

const int INF = 0x3f3f3f3f;
const int MAXN = 1000005; // 1e6;
int n,m;
int main()
{
	// freopen("in.txt","r",stdin);
	scanf("%d%d",&n,&m);
	int t = n*100+m*1800;
	// de(t)
	rep(i, 0, m)
	{
		t *= 2;
	}
	printf("%d\n",t);
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
 
public class Main {
	
	public static void main(String[] args) throws IOException {
		final Scanner sc = new Scanner(System.in);
		
		final char[] S = sc.next().toCharArray();
		
		int top = 0, bottom = 0, left = 0, right = 0;
		for(final char ch : S){
			if(ch == 'N'){
				top++;
			}else if(ch == 'S'){
				bottom++;
			}else if(ch == 'E'){
				right++;
			}else{
				left++;
			}
		}
		
		final boolean lr_ok = !(Math.min(left, right) == 0 && Math.max(left, right) != 0);
		final boolean ud_ok = !(Math.min(top, bottom) == 0 && Math.max(top, bottom) != 0);
		
		System.out.println((lr_ok && ud_ok) ? "Yes" : "No");
		
	}
 
	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;
 
		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}	
 
		private void getLine() throws IOException {
			while (!hasNext()) {
				tok = new StringTokenizer(br.readLine());
			}
		}
 
		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}
 
		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 8020
N = int(input())
G = [dict() for i in range(N)]
# グラフの表し方
for i in range(N-1):
    u,v,w = map(int,input().split())
    G[u-1][v-1] = w
    G[v-1][u-1] = w
color = [-1 for i in range(N)]
dist=[-1 for i in range(N)]
# 頂点1を根に根付き木を考える。頂点１からの距離
dist[0]=0
q=[0]
while(len(q)>0):
    r=q.pop()
    for p in G[r]:
        if dist[p]!=-1:
            continue
        dist[p]=dist[r]+G[r][p]
        q.append(p)

for i in range(N):
    print(dist[i]%2)

Measured memory_bytes: 49776
N = int(input())
A = list(map(int, input().split()))

Q = int(input())

total = sum(A)
counter = dict()

for i in range(100001):
    counter[i] = 0

for a in A:
    counter[a] += 1

for i in range(Q):
    b, c = map(int, input().split())
    total = total - (b * counter[b])
    total = total + (c * counter[b])
    counter[c] += counter[b]
    counter[b] = 0
    print(total)


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

using namespace std;

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

    int n;
    cin >> n;
    int a[n];
    int sum = 0;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        sum += a[i];
    }

    float avg = (float) sum / n;
    float diff = 100;
    int res;
    for (int i = 0; i < n; ++i) {
        if (abs(a[i] - avg) < diff) {
            res = i;
            diff = abs(a[i] - avg);
        }
    }

    cout << res << '\n';

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){

  int ans=0,i,r=0,l=0; 

  char c;

  for(;;){
    for(;;){

      scanf("%c",&c);

      if(c=='#'){
	break;
      }

      if(c=='\n'){
	break;
      }

      if(c=='q'||c=='w'||c=='e'||c=='r'||c=='t'||c=='a'||c=='s'||
	 c=='d'||c=='f'||c=='g'||c=='z'||c=='x'||c=='c'||c=='v'||c=='b'){

	l=1;
	if(l==1&&r==1){
	  ans++;
	}

	r=0;
      }

      else{

	r=1;
	if(l==1&&r==1){
	  ans++;
	}

	l=0;
      }
    }
  if(c=='#'){
	break;
      }


    printf("%d\n",ans);
    ans=0;
    r=0;
    l=0;
  }
    return 0;
  }

Measured memory_bytes: 964
let char_list_of_str s =
  let rec f res i = 
    if i < 0
    then res
    else f (s.[i]::res) @@ i-1
  in
  f [] (String.length s - 1)

let rec solve = function
  | []
      -> "YES"
  | 'e'::'r'::'a'::'s'::'e'::'r'::xs
  | 'e'::'r'::'a'::'s'::'e'::xs
  | 'd'::'r'::'e'::'a'::'m'::'e'::'r'::'a'::'s'::'e'::'r'::xs
  | 'd'::'r'::'e'::'a'::'m'::'e'::'r'::'a'::'s'::'e'::xs
  | 'd'::'r'::'e'::'a'::'m'::'e'::'r'::xs
  | 'd'::'r'::'e'::'a'::'m'::xs
      -> solve xs
  | _ -> "NO"

let () =
  Scanf.scanf "%s\n" char_list_of_str
  |> solve
  |> Printf.printf "%s\n"

Measured memory_bytes: 6144
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define Graph vector<vector<int>>
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1000000007;

int H, W;
vector<vector<char>> G(20, vector<char>(20));
vector<P> direction = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};

int bfs(P p){
    if(G[p.first][p.second] == '#') return 0;
    Graph dist(20, vector<int>(20, -1));
    int ans = 0;
    queue<P> que;
    que.push(p);
    dist[p.first][p.second] = 0;
    while(!que.empty()){
        P v = que.front();
        que.pop();
        for(P d : direction){
            P v2(v.first + d.first, v.second + d.second);
            if(v2.first < 0 || v2.first >= H || v2.second < 0 || v2.second >= W || G[v2.first][v2.second] == '#') continue;
            if(dist[v2.first][v2.second] != -1) continue;
            dist[v2.first][v2.second] = dist[v.first][v.second] + 1;
            ans = max(ans, dist[v2.first][v2.second]);
            que.push(v2);
        }
    }
    return ans;
    
}

int main(){
    cin >> H >> W;
    rep(i, H){
        rep(j, W){
            cin >> G[i][j];
        }
    }

    int ans = 0;
    rep(i, H){
        rep(j, W){
            ans = max(ans, bfs(P(i, j)));
        }
    }

    cout << ans << endl;
    
}

Measured memory_bytes: 256