akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-11;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

void dfs(int I,string s,vi a,vs &res){
	int n=s.size();
	if(I==n){
		res.push_back(s);
		return;
	}
	int id=s[I]-'a';
	if(a[id]) dfs(I+1,s,a,res);
	if(id<25&&!a[id+1]){
		s[I]++;
		a[id+1]=1;
		dfs(I+1,s,a,res);
	}
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	while(1){
		string s;
		cin>>s;
		if(s=="#") break;
		vs res;
		int n=s.size();
		vi a(26);
		a[0]=1;
		dfs(0,s,a,res);
		cout<<res.size()<<endl;
		if(res.size()<=10){
			for(auto i:res) cout<<i<<endl;
		}
		else{
			for(int i=0;i<5;i++) cout<<res[i]<<endl;
			for(int i=res.size()-5;i<res.size();i++) cout<<res[i]<<endl;
		}
	}
}


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

#define rep(l, r) for (int i = (l); i < (r); i++)

typedef long long ll;
 
using namespace std;

bool check_x(int *x, int N, int Z) {
    bool ok = true;
    rep(0, N) {
        if (Z <= x[i]) {
            ok = false;
            break;
        }
    }

    return ok;
}

bool check_y(int *y, int M, int Z) {
    bool ok = true;
    rep(0, M) {
        if (y[i] < Z) {
            ok = false;
            break;
        }
    }

    return ok;
}

void solve() {
    int N, M, X, Y;
    cin >> N >> M >> X >> Y;

    int x[N];
    rep(0, N) cin >> x[i];
    
    int y[M];
    rep(0, M) cin >> y[i];

    bool found = false;
    rep(0, 101) {
        if (X < i && i <= Y && check_x(x, N, i) && check_y(y, M, i)) {
            found = true;
            break;
        }
    }
    cout << (found ? "No War" : "War") << endl;
}

int main() {
    solve();

    return 0;
}


Measured memory_bytes: 256
/*
　　こんにちは。あたしはｶｳｶﾞｰﾙ。
　　redcoderになるためAtCoderを巡る旅をしてます。

　　　 　 ＿_
　　　 ヽ|＿_|ノ　　　　ﾓｫ
　　　　||‘‐‘||ﾚ　　_)_, ―‐ 、
　　　　/(Ｙ (ヽ＿ /・ ヽ　　 ￣ヽ
　　　　∠ ＿ ゝ　 ｀^ヽ ﾉ.::::_(ノヽ
　　　　 _/ヽ　 　　  /ヽ￣￣/ヽ
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define COUT(x) cout << (x) << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

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

    int n; cin >> n;
    vector<int> l(n + n);
    rep(i, n * 2) cin >> l[i];
    sort(ALL(l));
    int ans = 0;
    for(int i = 0; i < n + n; i += 2) {
        ans += l[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
from sys import stdin
a = stdin.readline()
w=int(a)
j=1
sumvalue=0
maxvalue=0
w2=[]
while j<=w:
    z = stdin.readline().rstrip('\n')
    sumvalue+=int(z)
    maxvalue=max(maxvalue,int(z))
    j+=1
print(sumvalue-int(maxvalue/2))

Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
 
typedef struct node_t {
    int key;
    struct node_t *parent;
    struct node_t *left;
    struct node_t *right;
} node;
 
node* newNode(int);
void print(node *);
void inorder(node *);
void preorder(node *);
void insert(int, node *);
node* find(int, node *);
void free_tree(node *);
 
int main(void)
{
    int i, m, k;
    char com[10];
    node *tree_root;
     
    tree_root = newNode(0);
     
    scanf("%d",&m);
    for (i=0; i<m; i++) {
        scanf("%s",com);
        if(com[0] == 'p') {
            print(tree_root->left);
        } else {
            scanf("%d",&k);
            if(com[0] == 'i') {
                insert(k, tree_root);
            } else if(com[0] == 'f') {
                if(find(k, tree_root) != NULL) {
                    printf("yes\n");
                } else {
                    printf("no\n");
                }
            }
        }
    }
     
    free_tree(tree_root);
     
    return 0;
}
 
node* newNode(int key)
{
    node *tmp;
     
    tmp = (node *)malloc(sizeof(node));
    if (tmp == NULL) exit(0);
     
    tmp->key = key;
    tmp->parent = NULL;
    tmp->left = NULL;
    tmp->right = NULL;
     
    return tmp;
}
 
void print(node *root)
{
    inorder(root);
    printf("\n");
    preorder(root);
    printf("\n");
}
 
void inorder(node *node)
{
     
    if(node->left != NULL) inorder(node->left);
    printf(" %d",node->key);
    if(node->right != NULL) inorder(node->right);
}
 
void preorder(node *node)
{
    printf(" %d",node->key);
    if(node->left != NULL) preorder(node->left);
    if(node->right != NULL) preorder(node->right);
}
 
void insert(int k, node *tree_root)
{
    node *x, *y, *z;
     
    z = newNode(k);
    y = tree_root;
    x = tree_root->left;
    while (x != NULL) {
        y = x;
        if(z->key < x->key) {
            x = x->left;
        } else {
            x = x->right;
        }
    }
    z->parent = y;
    if(y == tree_root || z->key < y->key) {
        y->left = z;
    } else {
        y->right = z;
    }
}
 
node* find(int k, node *tree_root) 
{
    node *x;
     
    x = tree_root->left;
    while (x->key != k) {
        if(x->key > k) {
            if(x->left == NULL) return NULL;
            x = x->left;
        } else {
            if(x->right == NULL) return NULL;
            x = x->right;
        }
    }
    return x;
}
 
void free_tree(node *root)
{
    if(root->left != NULL) free_tree(root->left);
    if(root->right != NULL) free_tree(root->right);
    free(root);
}

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

int n;
long long a[100010];
long long b[100010];
long long c[100010];
long long dp[100010][3];

int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i] >> b[i] >> c[i];

  dp[0][0] = a[0];
  dp[0][1] = b[0];
  dp[0][2] = c[0];

  for (int i = 1; i < n; ++i) {
    for (int j = 0; j <= 2; ++j) {
      dp[i][j] = 0;
    }
  }

  for (int i = 1; i < n; ++i) {
    for (int j = 0; j <= 2; ++j) {
      if (j == 0) {
        dp[i][j] = max(dp[i - 1][1], dp[i - 1][2]) + a[i];
      } else if (j == 1) {
        dp[i][j] = max(dp[i - 1][2], dp[i - 1][0]) + b[i];
      } else if (j == 2) {
        dp[i][j] = max(dp[i - 1][0], dp[i - 1][1]) + c[i];
      }
    }
  }

  cout << max(max(dp[n - 1][0], dp[n - 1][1]), dp[n - 1][2]) << endl;
  return 0;
}


Measured memory_bytes: 4992
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	bool[long] set;
	set[RD] = true;
	set[RD] = true;
	set[RD] = true;
	
	writeln(set.keys.length);
	stdout.flush();
	debug readln();
}

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

def ans(P, X):
    P = set(P)
    for i in range(200):
        if X - i not in P:
            return X-i 
        if X + i not in P:
            return X+i

X, N = input().split(' ')
X = int(X)
N = int(N)
if N == 0:
    print(X)
else:
    P = input().split(' ')
    P = [int(x) for x in P]

    print(ans(P, X))

Measured memory_bytes: 61908
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Main obj = new Main();
		obj.exec();
	}
	
	public void exec() {
		Scanner sc = new Scanner(System.in);
		int p = Integer.parseInt(sc.nextLine());
		String[] strArr = sc.nextLine().split(" ");
		sc.close();
		int[] aArr = new int[p];
		for(int i = 0; i < p ; i++) {
			aArr[i] = Integer.parseInt(strArr[i]);
		}
		
		int[] factArr = new int[p];
		int[] recipFactArr = new int[p]; 
		
		factArr[0] = 1;
		recipFactArr[0] = 1; 
		makeFactArr(factArr, p);
		makeRecipFactArr(recipFactArr,p,factArr[factArr.length - 1]);
		
		int[] coefArr = new int[p];
		for(int i = 0; i < p; i++) {
			if(aArr[i] == 0) {
				continue;
			}
			coefArr[p - 1] = mod(coefArr[p - 1] - 1,p);
			int powValue = 1;
			for(int j = 1; j <= p - 1; j++) {
				powValue = mod(powValue * (-i),p);
				int addValue;
				int factValue = mod(mod(factArr[p - 1] * recipFactArr[j],p) * recipFactArr[p - 1 - j], p);
				addValue = mod(factValue * powValue,p);
				
				coefArr[p - 1 - j] = mod(coefArr[p - 1 - j] - addValue,p);
			}
			coefArr[0] = mod(coefArr[0] + 1, p);
//			System.out.println(Arrays.toString(coefArr));
		}
		
		for(int i = 0; i < p; i++) {
			System.out.print(coefArr[i]);
			if(i == p - 1) {
				System.out.print("\n");
			}else {
				System.out.print(" ");
			}
		}
		System.out.flush();
	}
	
	public long fact(long n) {
		long result = 1;
		for(long i = 1;i <= n;i++ ) {
			result *= i;
		}
		return result;
	}
	
	public void makeFactArr(int[] factArr, int base) {
		for(int i = 1; i < factArr.length; i++) {
			factArr[i] = mod(factArr[i-1] * i, base);
 		}
	}
	
	public void makeRecipFactArr(int[] recipFactArr, int base, int lastFactVal) {
		recipFactArr[recipFactArr.length - 1] = makePowWithBase(lastFactVal, base - 2, base);
		for(int i = recipFactArr.length - 1; i > 0; i--) {
			recipFactArr[i - 1] = mod(recipFactArr[i]*i,base);
		}
	}
	
	public int makePowWithBase(int value, int time, int base) {
		int retVal = 1;
		for(int i = 0; i < time; i++) {
			retVal = mod(retVal * value,base);
		}
		return retVal;
	}
	
	public int munusSurplus(int value, int base) {

		int invValue = value * (-1);
		if(invValue % base == 0) {
			return 0;
		}
		int x = invValue / base;
		return value + ((x + 1) * base);
	}
	
	public int mod(int value, int base) {
		if(value < 0) {
			return munusSurplus(value, base);
		}else {
			return value % base;
		}
	}

}

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

int main(void){
  int n;
  cin >> n;
  int n1 = n/10;
  int n2 = n%10;
  if(n1 == 9)
    cout << "Yes" << '\n';
  
  else{
    if(n2 == 9)
      cout << "Yes" << '\n';
    
    else
      cout << "No" << '\n';
    
  }
}


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

using namespace std;

int main(){
    int A, B, C, D;
    string winner = "aok";
    cin >> A >> B >> C >> D;
    while(A > 0 && C > 0){
        C -= B;
        if (C <= 0) winner = "tkhs";
        A -= D;
        //cout << winner << endl;
    }
    if (winner == "tkhs"){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

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

using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ll> vi;
typedef long double ld; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	string s; cin>>s;
	if(s.length()%2==0)
	{
		for(int i=0;i<s.length();i++)
		{
			if(i&1)
			{
				if(s[i]!='i'){cout<<"No\n"; return 0;}
			}
			else
			{
				if(s[i]!='h'){cout<<"No\n"; return 0;}
			}
		}
		cout<<"Yes\n";
	}
	else
	{
		cout<<"No\n"; return 0;
	}
		
}


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

#define LL long long
#define fi first
#define se second
#define mp make_pair
#define pb push_back

using namespace std;

LL gcd(LL a,LL b){return b?gcd(b,a%b):a;}
LL lcm(LL a,LL b){return a/gcd(a,b)*b;}
LL powmod(LL a,LL b,LL MOD){LL ans=1;while(b){if(b%2)ans=ans*a%MOD;a=a*a%MOD;b/=2;}return ans;}
const int N = 2e5 +11;
int n,a[N],b[N],x;
int main(){
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1;i<=n;i++){cin>>b[i];if(a[i]-b[i]>0)x+=a[i]-b[i];}
		cout<<x<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<string>
#include<cmath>

using namespace std;

int main() {
	int n; cin >> n;
	int h[n];
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}
	int dp[n];
	dp[0] = 0;
	dp[1] = abs(h[1] - h[0]);

	for (int i = 2; i < n; i++) {
		dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
	}
	cout << dp[n - 1] << endl;

}

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


void main() {
    int n;
    scan(n);

    int[string] a;

    foreach (i ; 0 .. n) {
        auto s = readln.chomp;
        if (s in a) {
            a[s]++;
        }
        else {
            a[s] = 1;
        }
    }

    int m;
    scan(m);
    foreach (i ; 0 .. m) {
        auto s = readln.chomp;
        if (s in a) {
            a[s]--;
        }
        else {
            a[s] = -1;
        }
    }
    
    int ans;
    foreach (i ; a.byValue) {
        ans = max(ans, i);
    }
    writeln(ans);
}


void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pi acos(-1)
#define pb push_back
using namespace std;
typedef pair<int,int> p;
typedef long long ll;

int main(){
	int n,l,r,sum=0;
	cin>>n;
	rep(i,n){
		cin>>l>>r;
		sum+=(r-l+1);
	}
	cout<<sum<<endl;
	return 0;
}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000001

int panel[121][121];
int dd[] = {0, 1, 1, 0, -1, -1, 0};

void wfs(int x, int y, int t) {
  priority_queue<PIP> q;
  q.push(PIP(t, P(x, y)));
  while(!q.empty()) {
    PIP p = q.top(); q.pop();

    if (panel[p.se.se][p.se.fi] == 1) continue;
    else panel[p.se.se][p.se.fi] = 1;

    if (p.fi == 0) continue;
    rep(i, 6) {
      int yy = p.se.se + dd[i], xx = p.se.fi + dd[i + 1];
      if (panel[yy][xx] == 0) q.push(PIP(p.fi - 1, P(xx, yy)));
    }
  }
}

int main(){
  cin.sync_with_stdio(false);
  int t, n;
  while(cin >> t >> n, t | n) {
    rep(i, 121)rep(j, 121) panel[i][j] = 0;

    rep(i, n) {
      int x, y;
      cin >> x >> y; x += 60, y += 60;
      if (0 <= x && x < 121 && 0 <= y && y < 121) panel[y][x] = 2;
    }

    int x, y;
    cin >> x >> y;
    wfs(x + 60, y + 60, t);

    int ans = 0;
    rep(i, 121)rep(j, 121) if (panel[i][j] == 1) ans++;
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 3164
#include <iostream>
 
using namespace std;
 
int main(){
	
	int n,m,h,i,a[100],b[100],ans[100];
	
	for(i=1;i<=80;i++){
		a[i]=0;
		b[i]=0;
		ans[i]=0;
	}
	
	cin >> n >> m;
	
	for(i=1;i<=m;i++){
		cin >> a[i] >> b[i];
	}
	
	for(h=1;h<=n;h++){
		for(i=1;i<=m;i++){
			if(a[i]==h){
				ans[h]=ans[h]+1;
			}
		}
	}

	for(h=1;h<=n;h++){
		for(i=1;i<=m;i++){
			if(b[i]==h){
				ans[h]=ans[h]+1;
			}
		}
	}
	
	for(i=1;i<=n;i++){
		cout << ans[i] << endl;
	}

	return 0;
	
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n=int(input())
A=list(map(int,input().split()))
for ai in A:
  if ai % 2 == 0:
    if not(ai % 3 == 0 or ai % 5 == 0):
      print("DENIED")
      exit()
print("APPROVED")

Measured memory_bytes: 38256
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = { 1,0 }, dy[] = { 0,1 }, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long>dij;
struct edge { long long to, cost; };
vector<vector<edge> >G;

long long mod_pow(long long a, long long b) {
	long long res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}

	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

//↑template↑



double a, b, c, ans;
int main() {
	cin >> a >> b >> c;
	for (double i = 1; i < c + 0.5; ++i) {
		if (fmod(i, a) == 0) { ans += b; }
	}
	cout << ans << endl;
}

Measured memory_bytes: 384
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		int num = 100000;
		int nums,numc;
		Scanner s = new Scanner(System.in);
		int weeks = s.nextInt();
		for(int i = 0;i < weeks;i++){
			num *= 1.05; 
			nums = num % 1000;
			numc = num / 1000;
			
			if(nums > 0){
				num = numc * 1000 + 1000;
			}
		}

		System.out.println(num);
		
	}
}

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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a, b) accumulate(all(a), b)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define ios() cin.tie(0), ios::sync_with_stdio(false)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
typedef unsigned long long ull;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
ll const INF = 1e18;

template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    int a, b;
    cin >> a >> b;
    int ans = 0;
    if(a > b) ans = a + a - 1;
    else if(a < b) ans = b + b - 1;
    else ans = a + b;
    cout << ans << endl; 
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <string.h>
int main(void) {
	int A, B, C;
	scanf("%d%d%d", &A, &B, &C);
	int X[3] = { A,B,C };
	
	if (A == B) {
		printf("%d", C);
	}
	else if (B == C) {
		printf("%d", A);
	}
	else {
		printf("%d", B);
	}


	return 0;

}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
const ll INF = 1LL << 60;


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

    int ans = N;
    for(int i=0;i<=N;++i){ // i = 6だけで払う金額, どれだけ６で引き出せば最小になるか
        int ret = 0;
        int six = i; // 6で払う金額
        while(six > 0){
            ret += six % 6;
            six /= 6;
        }

        int nine = N - i; // 9で払う金額
        while(nine > 0){
            ret += nine % 9;
            nine /= 9;
        }
        chmin(ans,ret);
    }
    

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
bool prime[10000005];
vector < int > yotsugo;
 
int main()
{
    int N;
    fill_n(prime, 10000005, true);
 
    for ( int i = 2; i < 3335; i++ ) {
        if ( prime[i] ) {
            for ( int j = i * i; j < 10000005; j += i ) {
                prime[j] = false;
            }
        }
    }
    for ( int i = 5; i <= 10000000 - 8; i++ ) {
        if ( prime[i] && prime[i + 2] && prime[i + 6] && prime[i + 8] ) {
            yotsugo.push_back(i + 8);
        }
    }
 
    while ( cin >> N , N != 0 ) {
        cout << *(upper_bound(yotsugo.begin(), yotsugo.end(), N) - 1) << endl;
    }
 
    return ( 0 );
}


Measured memory_bytes: 12888
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < static_cast<int>(n); ++i)
#define REPR(i, n) for (int i = static_cast<int>(n) - 1; i >= 0; --i)
#define FOR(i, a, b) \
  for (int i = static_cast<int>(a); i < static_cast<int>(b); ++i)
#define FORR(i, a, b) \
  for (int i = static_cast<int>(b) - 1; i >= static_cast<int>(a); --i)
#define ALL(f, x, ...) \
  ([&](auto& y) { return (f)(begin(y), end(y), ##__VA_ARGS__); })(x)
auto INDEX = [](auto& x, auto& xs) { return &x - &xs[0]; };
void async_io() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}
const auto inf = INT_MAX / 3;
const auto pi = 2 * std::acos(0.0);
const auto eps = 1e-14;
using ll = signed long long;
using ull = unsigned long long;

signed main() {
  async_io();
  int n;
  while (true) {
    cin >> n;
    if (n == 0) return 0;
    auto sum = 0;
    for (int i = 2;; i++) {
      auto base = i * (i + 1) / 2;
      if (base > n) break;
      if ((base - n) % i == 0) sum++;
    }
    cout << sum << "\n";
  }
}

Measured memory_bytes: 3004
def gcd(a, b):
    r = a % b
    return b if r == 0 else gcd(b, r)


k = int(input())

answer = 0
for a in range(1, k + 1):
    for b in range(1, k + 1):
        for c in range(1, k + 1):
            temporary = gcd(a, b)
            temporary = gcd(temporary, c)
            answer += temporary

print(answer)


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

int main(){
    int n;
    cin>>n;
    vector<int> a(n), b(n), c(n);
    rep(i,n) cin>>a[i];
    rep(i,n) cin>>b[i];
    rep(i,n) cin>>c[i];
    sort(a.begin(),a.end());
//    sort(b.begin(),b.end());
    sort(c.begin(),c.end());
    ll ans=0;
    rep(i,n){
        ll s=lower_bound(a.begin(),a.end(),b[i])-a.begin();
        ll s1=c.end()-lower_bound(c.begin(),c.end(),b[i]+1);
        ans+=s*s1;
   }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 4584
using namespace std;
#include 		<bits/stdc++.h>
#define	fi 		first
#define se 		second
#define pb 		push_back
#define mp 		make_pair
#define maxn	500005
#define inf		int(21e8)
#define mod		int(1e9+7)
#define db		double
#define ll		long long
#define si 		stack<int>
#define qi 		queue<int>
#define vi 		vector<int>
#define pi 		pair<int, int>
#define pq  	priority_queue< int, vector<int>, greater<int> >
ll powmod(ll a, ll b) {
	ll res = 1; a %= mod;
	for (; b; b >>= 1)
		res = (res * ((b & 1) ? a : 1)) % mod,
		a = a * a % mod;
	return res;
}
ll gcd(ll a, ll b) {return b ? gcd(a, b) : a;}
int a[maxn];
int main() {
	int n;
	cin >> n;
	for(int i = 1; i <= n; i ++) cin >> a[i];
	sort(a + 1, a + n + 1); reverse(a + 1, a + n + 1);
	ll ans = a[1], cnt = 2;
	for(int i = 2; i <= n; i ++) {
		if(cnt < n) ans += a[i], ++ cnt;
		if(cnt < n) ans += a[i], ++ cnt;
	}
	cout << ans << endl;
	system("pause");
	return 0;
}

Measured memory_bytes: 4472
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
  string a, b, c;
  cin >> a >> b >> c;
  
  if (a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0]) {
	cout << "YES" << endl;
  }
  else {
	cout << "NO" << endl;
  }
}

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

int main(void){
    int a = 0, b = 0; 

    scanf("%d%d", &a, &b);
    
    if((a + b) % 2 == 0){
        printf("%d\n", (a + b) / 2);
    }else{
        printf("%d\n", (a + b) / 2 + 1);
    }

    return 0;

} 


Measured memory_bytes: 256
t,T,a,A,b,B=map(int,open(0).read().split())
x,y=(b-a)*t,(A-B)*T
if y-x==0:
 r="infinity"
else:
 s,t=divmod(x,y-x)
 r=max(0,s*2+bool(t))
print(r)


Measured memory_bytes: 2940
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL


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

    int n;
    cin >> n;

    s64 a;
    vs64 s(n + 1);
    s[0] = 0;
    rep (i, n)
    {
        cin >> a;
        s[i + 1] = s[i] + a;
    }
    sort(s.begin(), s.end());

    s64 ans = 0;
    s64 now = s[0];
    s64 pre = s[0];
    int i = 0;
    int j = 0;
    while (i < n + 1)
    {
        while (now == pre && i < n + 1)
        {
            ++i;
            now = s[i];
        }
        s64 temp = i - j;
        ans += temp * (temp - 1) / 2;
        pre = s[i];
        j = i;
    }

    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define endl "\n"

const long long INF = (long long)1e18;
const long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int x, y, z, ans = 0;
	
	cin>>x;
	
	y = x / 11;
	
	z = y * 11;
	
	x -= z;
	
	if(x == 0){
		cout<<y*2<<endl;
	} else if(x <= 6){
		cout<<y*2+1<<endl;
	} else {
		cout<<y*2+2<<endl;
	}
	
	return 0;
}

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

plusmax = A[0]+A[1]
minusmax = -A[0]-A[1]

for i in range(2,N):
    m1 = max(plusmax,minusmax)+A[i]
    m2 = max(plusmax-2*A[i-1],minusmax+2*A[i-1])-A[i]
    plusmax, minusmax = m1,m2

print(max(plusmax,minusmax))



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

int main(void) {

	int n;
	int i = 0;
	long long ii = 0;
	int pt = 0;
	int x[1000];
	int y[1000];
	double d[4] = { 0 };

	scanf("%d", &n);

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

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

	for (i = 0; i < n; i++){
		d[0] += abs(x[i] - y[i]);
	}

	for (i = 0; i < n; i++) {
		pt += abs(x[i] - y[i]) * abs(x[i] - y[i]);
		d[1] = sqrt(pt);
	}

	for (i = 0; i < n; i++) {
		ii += abs(x[i] - y[i]) * abs(x[i] - y[i]) * abs(x[i] - y[i]);
		d[2] = pow(ii, 1.0 / 3.0);
	}

	for (i = 0; i < n; i++) {
		for (ii = 1000; ii > d[3]; ii--) {
			if (ii == abs(x[i] - y[i])) d[3] = ii;
		}
	}

	printf("%lf\n%lf\n%lf\n%lf\n", d[0], d[1], d[2], d[3]);
	return 0;
}

Measured memory_bytes: 700
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF = 1e18+18;
const ll MAX = 200000;
const ll MOD = 1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;

int main(){
    ll a, b, c;
    cin>>a>>b>>c;
    if(c<=a+b){
        cout<<"No"<<endl;
        return 0;
    }
    ll X=c-a-b;
    X=X*X;
    X-=4*a*b;
    Yes(X>0);


}

Measured memory_bytes: 256
/*
Author : N_o_o_B
Created : January 21 2020 13:01:34 
*/
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
//typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define trav(x,a) for(auto& x:a)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;
    char c[2];
    fori(i,2) cin >> c[i];
    string s ="";
    fori(i,(c[1]-'0')){
        s += c[0];
    }
    string t ="";
    fori(i,(c[0]-'0')){
        t += c[1];
    }
    cout << min(s,t) << endl;
    time_taken();
    return 0;
}

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

#define ll long long
#define Fi first
#define Se second
#define Pb push_back
#define vi vector<int>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>
#define vvp vector<vector<pair<int,int>>>

const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<int>>; //Caution!! Segmentation Fault!! Don't forget to add +1!

#define all(v) v.begin(),v.end()
#define output_s(a) printf("%s\n",(a).c_str())

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m) for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m) for(int i=(int)(n);i>=(int)(m);i--)
#define RepA(x) for(auto &item:(x))

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

template<typename TypeInt> //最大公約数
TypeInt GCD(TypeInt a,TypeInt b){
    if(a%b==0) return b;
    else return GCD(b,a%b);
}
template<typename TypeInt> //最小公倍数
TypeInt LCM(TypeInt a,TypeInt b){
    return a*b/GCD(a,b);
}

int IN_int(){
    int x;
    scanf("%d",&x);
    return x;
}

//library----------------------------------------------

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

const int NMAX = 100;
bool flag;

bool comp(int x,int y){
    return abs(0-x)<abs(0-y);
}

signed main(){
    int N=IN_int();
    int ans=1;
    RepS(i,1,N){
        int x=IN_int();
        if(x==ans)ans++;
    }
    printf("%d\n",ans!=1?N-ans+1:-1);

    return 0;
}

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

const ll mod = 1000000007;
ll fact[210200];
ll invfact[210200];

inline ll take_mod(ll a){
    return (a % mod + mod) % mod;
}

inline ll add(ll a, ll b){
    return take_mod(a+b);
}

inline ll sub(ll a, ll b){
    return take_mod(a-b);
}


inline ll mul(ll a, ll b){
    return take_mod(a * b);
}

inline ll pow(ll x, ll n){
    ll res = 1LL;
    while(n > 0){
        if(n & 1) res = mul(res, x);
        x = mul(x, x);
        n >>= 1;
    }
    return res;
}

ll mod_inv(ll x){
    return pow(x, mod-2);
}

// nは上限
void make_fact(ll n){
    fact[0] = 1;
    ll res = 1;
    for(int i = 1; i <= n; i++){
        fact[i] = res;
        res = mul(res, i+1);
    }
}

// nは上限
void make_invfact(ll n){
    invfact[0] = 1;
    invfact[n] = mod_inv(fact[n]);
    for(int i = n-1; i >= 1; i--){
        invfact[i] = mul(invfact[i + 1], i + 1);
    }
}

ll perm(ll n, ll k){
    return mul(fact[n], invfact[n-k]);
}

ll comb(ll n, ll k){
    if(k == 0){
        return 1;
    }
    return mul(mul(fact[n], invfact[n-k]), invfact[k]);
}

int main() {
    ll n, m, k;
    cin >> n >> m >> k;

    make_fact(210000);
    make_invfact(210000);

    ll res = mul(m, mul(m, mul(n, mul(n-1, mul(n+1, mod_inv(6))))));
    res = add(res, mul(n, mul(n, mul(m, mul(m-1, mul(m+1, mod_inv(6)))))));
    res = mul(res, comb(sub(mul(n, m), 2), sub(k, 2)));

    cout << res << endl;
}

Measured memory_bytes: 3584
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
const int INF = 1000000007;
typedef long long ll;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
ll facm(ll a) { return a > 1 ? facm(a - 1) * a % INF : 1; }
int main(){
  // ios::sync_with_stdio(false);cin.tie(nullptr);
  int n,m;
  cin >> n >> m;
  if(abs(n - m) > 1){
    puts("0");
    return 0;
  }
  int a = max(n,m);
  int b = min(n,m);
  ll ans = 1;
  int count = 0;
  if(n - m == 0){
    cout << facm(n) % INF * facm(m) * 2 % INF << endl;
  }
  else{
    cout << facm(n) % INF * facm(m) % INF << endl;
  }
  return 0;
}

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

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

    vector<vector<int> > c(3, vector<int>(3, 0));
    REP(i, 3) REP(j, 3) {
        cin >> c[i][j];
    }

    bool ans = true;
    REP(j, 3 - 1) REP(i, 3 - 1)
        if ((c[i][j] - c[i][j+1]) != (c[i+1][j] - c[i+1][j+1]))
            ans = false;

    if (ans) cout << "Yes" << '\n';
    else cout << "No" << '\n';
    return 0;
}


Measured memory_bytes: 256
/*

Code for problem C by cookiedoth
Generated 21 Mar 2020 at 04.36 PM


______▄███████▄_______
______█▄█████▄█_______
______█▼▼▼▼▼█_______
_____██________ ██______
______█▲▲▲▲▲█_______
______█████████_______
_______██____ ██________

>_<
o_O
^_^

*/

#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <functional>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <complex>
#include <cassert>
#include <random>
#include <cstring>
#include <numeric>
#define ll long long
#define ld long double
#define null NULL
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define debug(a) cerr << #a << " = " << a << endl
#define forn(i, n) for (int i = 0; i < n; ++i)
#define sz(a) (int)a.size()

using namespace std;

template<class T> int chkmax(T &a, T b) {
	if (b > a) {
		a = b;
		return 1;
	}
	return 0;
}

template<class T> int chkmin(T &a, T b) {
	if (b < a) {
		a = b;
		return 1;
	}
	return 0;
}

template<class iterator> void output(iterator begin, iterator end, ostream& out = cerr) {
	while (begin != end) {
		out << (*begin) << " ";
		begin++;
	}
	out << endl;
}

template<class T> void output(T x, ostream& out = cerr) {
	output(x.begin(), x.end(), out);
}

void fast_io() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

struct graph {
	vector<vector<int> > g;
	int n, m;

	graph() {}

	void read(int _n) {
		n = _n;
		cin >> m;
		g.resize(n);
		for (int i = 0; i < m; ++i) {
			int u, v;
			cin >> u >> v;
			u--;
			v--;
			if (u > v) {
				swap(u, v);
			}
			g[u].push_back(v);
		}
	}

	vector<int> val, used;

	vector<int> calc_f() {
		val.resize(n);
		used.resize(n + 1, -1);
		for (int i = n - 1; i >= 0; --i) {
			for (auto v : g[i]) {
				used[val[v]] = i;
			}
			for (int j = 0; j <= n; ++j) {
				if (used[j] != i) {
					val[i] = j;
					break;
				}
			}
		}
		return val;
	}
};

const int MOD = 998244353;
const int C = (ll)1e18 % (ll)MOD;

int mul(int a, int b) {
	return (1LL * a * b) % MOD;
}

int power(int a, int deg) {
	int res = 1;
	while (deg) {
		if (deg & 1) {
			res = mul(res, a);
		}
		a = mul(a, a);
		deg >>= 1;
	}
	return res;
}

void add(int &a, int b) {
	a = (a + b) % MOD;
}

int diff(int a, int b) {
	return (a - b + MOD) % MOD;
}

graph G1, G2, G3;
vector<int> v1, v2, v3;
map<int, int> mp1, mp2, mp3;
int sum1, sum2, sum3;

void calc_map(vector<int> &v, map<int, int> &mp, int &sum) {
	for (int i = 0; i < v.size(); ++i) {
		add(mp[v[i]], power(C, i + 1));
		add(sum, power(C, i + 1));
	}
}

int n;

signed main() {
	fast_io();
	cin >> n;
	G1.read(n);
	v1 = G1.calc_f();
	G2.read(n);
	v2 = G2.calc_f();
	G3.read(n);
	v3 = G3.calc_f();
	calc_map(v1, mp1, sum1);
	calc_map(v2, mp2, sum2);
	calc_map(v3, mp3, sum3);
	int ans = 0;
	for (auto pp1 : mp1) {
		for (auto pp2 : mp2) {
			add(ans, mul(mul(pp1.second, pp2.second), mp3[pp1.first ^ pp2.first]));
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 16256
char t[1002],m[9],o[999];c,n,w;M(d){t[c]=t[c+d];t[c+d]='^';c+=d;}D(){memmove(t+c+1,t+c+2,strlen(t+c+1));}main(l){scanf("%*d");for(;t[1]=0,getchar(),~scanf("%[^\n]",t+1);){t[0]='^';c=0;scanf("%d",&n);for(;n--;){scanf("%s",m);if(strcmp(m,"insert")==0){scanf(" \"%[^\"]\"",o);l=strlen(o);memmove(t+c+l,t+c,strlen(t+c)+1);memcpy(t+c,o,l);c+=l;}else{scanf("%s",o);w=*o-'c';if(strcmp(m,"forward")==0){if(w){for(;t[c+1]==' ';)M(1);for(;t[c+1]&&t[c+1]!=' ';)M(1);}else{if(t[c+1])M(1);}}else if(strcmp(m,"backward")==0){if(w){for(;c>0&&t[c-1]==' ';)M(-1);for(;c>0&&t[c-1]!=' ';)M(-1);}else{if(c>0)M(-1);}}else{if(w){int p=c;for(;t[p+1]==' ';)p++;if(t[p+1]&&t[p+1]!=' '){for(;t[p+1]&&t[p+1]!=' ';)p++;for(;t[c+1]==' ';)D();for(;t[c+1]&&t[c+1]!=' ';)D();}}else{if(t[c+1])D();}}}}puts(t);}}

Measured memory_bytes: 0
package main

import (
	"fmt"
	"sort"
)

func main() {
	var a, b, c int
	fmt.Scanf("%d %d %d", &a, &b, &c)
	plane := []int{a, b, c}
	sort.Ints(plane)
	fmt.Printf("%d", plane[0]+plane[1])
}


Measured memory_bytes: 512
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

def main():
	N = inputInt()
	xy = []
	seq = []

	for i in range(N):
		x,y = inputMap()
		xy.append((x,y))
		seq.append(i)

	ptns = list(itertools.permutations(seq))

	anss = []
	for ptn in ptns:
		ptn_list = list(ptn)

		strt = 0
		for i,val in enumerate(ptn_list):
			if i == 0:
				strt = val
				continue

			stx, sty = xy[strt]
			sdx, sdy = xy[val]
			tmptmp = ((stx-sdx)**2) + ((sty-sdy)**2)
			tmp = math.sqrt(tmptmp)
			anss.append(tmp)

	ans = 0
	for i in anss:
		ans += i

	print(ans/len(ptns))




if __name__ == "__main__":
	main()


Measured memory_bytes: 59252
import java.util.Scanner

import scala.annotation.tailrec


object Main {

  case class Store(price: Long, purchaseLimit: Int)

  def read() = {
    val sc = new Scanner(System.in)
    val nStores, nNecessaryDrinks = sc.nextInt()
    val stores: IndexedSeq[Store] = for (i <- 0 until nStores) yield {
      val price, purchaseLimit = sc.nextInt()
      Store(price.toLong, purchaseLimit)
    }
    (nStores, nNecessaryDrinks, stores)
  }

  @tailrec
  def purchase(totalPrice: Long, nNecessaryDrinks: Int, stores: List[Store]): Long = {
    stores match {
      case store :: _ if nNecessaryDrinks <= store.purchaseLimit =>
        totalPrice + store.price * nNecessaryDrinks
      case store :: restStores =>
        purchase(totalPrice + store.price * store.purchaseLimit,
          nNecessaryDrinks - store.purchaseLimit,
          restStores)
    }
  }

  def solve(nStores: Int, nNecessaryDrinks: Int, stores: IndexedSeq[Store]): Long = {
    // 値段でソートする
    val sortedStores = stores.sortBy(store => store.price)

    purchase(0, nNecessaryDrinks, sortedStores.toList)
  }

  def main(args: Array[String]): Unit = {
    val (nStores, nNecessaryDrinks, stores) = read()
    println(solve(nStores, nNecessaryDrinks, stores))
  }
}

Measured memory_bytes: 72608
#include<cstdio>
#include<algorithm>
using namespace std;
using ull = unsigned long long;

int main(){
	ull A, B, N;
	scanf("%llu %llu %llu", &A, &B, &N);
	printf("%llu\n", A*min(B - 1, N)/B);
	return 0;
}

Measured memory_bytes: 1732
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <climits>
//#include "h.h"
using namespace std;

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define pm(first, second) pb(mp(first, second))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()

int main(){

	while(true){
		int d, w;
		cin >> d >> w;
		if(d == 0 && w == 0)break;
		vector<vector<int>> ELEV(d, vector<int>(w));
		for(int i = 0; i < d; i ++){
			for(int j = 0; j < w; j ++){
				cin >> ELEV[i][j];
			}
		}
		int ans = 0;
		for(int d1 = 0; d1 < d - 2; d1 ++){
		for(int w1 = 0; w1 < w - 2; w1 ++){
			for(int d2 = d1 + 2; d2 < d; d2 ++){
			for(int w2 = w1 + 2; w2 < w; w2 ++){
				int edgeMin = 100;
				for(int i = w1; i <= w2; i ++){
					edgeMin = min(edgeMin, ELEV[d1][i]);
					edgeMin = min(edgeMin, ELEV[d2][i]);
				}
				for(int i = d1; i <= d2; i ++){
					edgeMin = min(edgeMin, ELEV[i][w1]);
					edgeMin = min(edgeMin, ELEV[i][w2]);
				}
				int tmp = 0;
				bool flag = true;
				for(int i = d1 + 1; i < d2 && flag; i ++){
					for(int j = w1 + 1; j < w2 && flag; j ++){
						if(ELEV[i][j] >= edgeMin){
							flag = false;
							break;
						}
						tmp += edgeMin - ELEV[i][j];
					}
				}
				if(flag)ans = max(ans, tmp);
			}
			}
		}
		}
		cout << ans << endl;
	}

	return 0;
}


Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long modpow(long long a, long long b){
	long long ans = 1;
	while (b > 0){
		if (b % 2 == 1){
			ans *= a;
			ans %= MOD;
		}
		a *= a;
		a %= MOD;
		b /= 2;
	}
	return ans;
}
long long modinv(long long a){
	return modpow(a, MOD - 2);
}
int main(){
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; i++){
    cin >> A[i];
  }
  long long sum = 0;
  long long sqsum = 0;
  for (int i = 0; i < N; i++){
    sum += A[i];
    sum %= MOD;
    sqsum += A[i] * A[i];
    sqsum %= MOD;
  }
  long long ans = (sum * sum - sqsum + MOD) % MOD;
  ans *= modinv(2);
  ans %= MOD;
  cout << ans << endl;
}

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

typedef long long int ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define sz(x) int(x.size())
const ll mod = 1000000007;
const ll INF = 1001001001001001;

int main() {
    string s; cin >> s;
    if (s == "SUN") cout << 7 << endl;
    if (s == "MON") cout << 6 << endl;
    if (s == "TUE") cout << 5 << endl;
    if (s == "WED") cout << 4 << endl;
    if (s == "THU") cout << 3 << endl;
    if (s == "FRI") cout << 2 << endl;
    if (s == "SAT") cout << 1 << endl;
    return 0;
}


Measured memory_bytes: 3592
#pragma GCC optimize("Ofast")
#include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;
int main(){
	int i,n,t,ans=0;
	double a,v=100;
	scanf("%lf",&a);
	while(v<a){
		v*=(double)1.01;
		v=(long long)v;
		ans++;
	}
	printf("%d\n",ans);
}


Measured memory_bytes: 1744