akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define STR string
#define Fst first
#define Snd second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
int n;
ll a[200010];
ll res;
map<ll, int> mp;
int main()
{
	cin >>n;
	for (int i=0;i<n;i++) cin >>a[i];
	sort(a,a+n);
	res+=a[n-1],mp[a[n-2]]+=2;
	for (int tr=n-3;tr>=0;tr--)
	{
		map<ll, int>::iterator it=mp.end();
		it--;
		res+=it->Fst;
		it->Snd--;
		if (!it->Snd) mp.erase(it);
		mp[a[tr]]+=2;
	}
	cout <<res;
	return 0;
}

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

int main() {
    int X;
    cin >> X;
    ll ans = 0;
    for (int i = 1; i <= X; ++i) {
        ll a = X / i;
        ll b = i * a * (a + 1) / 2;
        ans += b;
    }
    cout << ans << endl;
}

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

int main(){
  int n,i;
  int a,b,c;
  cin >> n;
  
  if( n <= 1000){
    for(i = 0; i < n ; i++){
      cin >>a >> b >> c ;
      if( 1 <= a && a <= 1000 && 1 <= b && b <= 1000 && 1 <= c && c <= 1000){
	if( a*a + b*b == c*c){
	  cout << "YES" <<endl;
	}
	else if ( a*a + c*c == b*b){
	  cout << "YES" <<endl;
	}
	else if ( b*b + c*c == a*a){
	  cout << "YES" <<endl;
	}
	else cout << "NO" << endl;
      }
    }
  }
  
  return 0;
}

Measured memory_bytes: 1156
#include <iostream>
#include <cmath>
using namespace std;
typedef long long LL;
const int N=200000+10;
int n,a[N];LL s[N];
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        s[i]=s[i-1]+a[i];
    }
    LL ans=5e18;
    for(int i=1;i<n;i++){
        ans=min(ans, abs(s[i] - (s[n]-s[i])));
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 2560
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

int main(){
	
	int n, i, j, cnt = 0, a = 0, b = 0, ab = 0;
	
	scanf("%d", &n);
	
	int have[n];
	char s[n][11];
	
	for(i = 0; i < n; i++){
		scanf("%s", s[i]);
	}
	
	int tmp;
	for(i = 0; i < n; i++){
		for(j = 0; j < strlen(s[i]) - 1; j++){
			if(s[i][j] == 'A' && s[i][j + 1] == 'B')
				cnt++;
		}
		tmp = 0;
		if(s[i][0] == 'B'){
			tmp++;
			b++;
		}
		if(s[i][strlen(s[i]) - 1] == 'A'){
			tmp++;
			a++;
		}
		if(tmp == 2)
			ab++;	
	}
	
	if(a == b){
		if(a == ab && a > 0)
			cnt += ab - 1;
		else
			cnt += a;
	}else{
		if(a > b)
			cnt += b;
		else
			cnt += a;
	}
	
	printf("%d", cnt);
	
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while(x->left != NIL){
    x = x->left;
  }
  return x;
}

Node treeMaximum(Node x){
  while(x->right != NIL){
    x = x->right;
  }
 return x;

}

Node treeSearch(Node u, int k){
  if(u==NIL || k == u->key){
    return u;
  }
  if(k<u->key){
    return treeSearch(u->left,k);
  }
  else return treeSearch(u->right,k);
}

Node treeSuccessor(Node x){
  Node y;
  if(x->right != NIL){
    return treeMinimum(x->right);
  }
  y = x->parent;
  while(y != NIL && x == y->right){
    x = y;
    y = y->parent;
  }
  return y;

}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y

  if(z->left==NIL || z->right== NIL){
    y = z;
  }
  else y = treeSuccessor(z);

  if(y->left != NIL){
    x = y->left;
  }
  else x = y->right;

  if(x!=NIL){
    x->parent= y->parent;
  }
  if(y->parent==NIL){
    root=x;
  }
  else if(y == y->parent->left){
    y->parent->left = x;
  }
  else y->parent->right = x;

  if(y != z){
    z->key = y->key;
  }
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x!=NIL){
    y = x;
    if(z->key<x->key){
      x= x->left;
    }
    else x = x->right;
  }
  z->parent = y;
  if(y == NIL){
    root = z;
  }
  else if(z->key < y->key){
    y->left = z;
  }
  else y->right = z;
}

void inorder(Node u){
  if(u==NIL){
    return;
  }
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
void preorder(Node u){
  if(u==NIL){
    return;
  }
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n, i, x;
  Node a;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }
  return 0;
}



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

const int MOD = 1000000007;
const int INF = 1e9;

int main(){
  int h,w;
  const int max_hw = 20;
  char s[max_hw + 1][max_hw + 1];
  cin >> h >> w;
  for(int i = 0 ; i < h; i++){
    for(int j = 0; j < w; j++){
      cin >> s[i][j];
    }
  }

  int dx[] = {1, -1, 0, 0};
  int dy[] = {0, 0, 1, -1};
  int now;
  int ans = 0;

  queue<pair<int, int>> todo;
  vector<vector<int>> seen(h, vector<int> (w, -1));

  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      for(int p = 0; p < h; p++){
        for(int q = 0; q < w; q++){
          if(i == p && j == q) continue;
          if(s[i][j] == '.' && s[p][q] == '.'){
            //BFS
            //s[i][j] = start point, s[p][q] = goal point
            // cout << "start =" << i << "," << j << endl;
            // cout << "end = " << p << "," << q << endl;

            seen[i][j] = 0;
            todo.push(make_pair(i, j));

            while(!todo.empty()){
              int x = todo.front().first;
              int y = todo.front().second;
              todo.pop();

              for(int k = 0; k < 4; k++){
                int nx = x + dx[k];
                int ny = y + dy[k];
                if(nx >= 0 && nx < h && ny >= 0 && ny < w && s[nx][ny] == '.'){
                  if(seen[nx][ny] == -1){
                    seen[nx][ny] = seen[x][y] + 1;
                    if(nx == p && ny == q) now = seen[nx][ny];
                    todo.push(make_pair(nx, ny));
                  }
                }
              }
            }
            ans = max(ans, now);
            // cout << now << endl;
            for(int a = 0; a < h; a++){
              for(int b = 0; b < w; b++){
                seen[a][b] = -1;
              }
            }
          }
        }
      }
    }
  }

  cout << ans << endl;

  return 0;
}

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

#define FOR(i, a, b) for (int i = (a); i < (b); i++)

typedef long long ll;

int main() {
  int n;
  cin >> n;
  string s, t;
  cin >> s >> t;
  FOR(i, 0, n) {
    cout << s[i];
    cout << t[i];
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		
		char[] str = sc.next().toCharArray();
		
		str[k - 1] += 32;
		
		System.out.println(str);
	}

}


Measured memory_bytes: 23892
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;
int main(void) {
	int k,x;
	cin >> k>>x;
	if (k * 500 >= x)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int n ,m ,k ,t;
int main() 
{	
	int a ,b ,c;
	while(cin>>a>>b>>c)
	{
		int res = b+c-a;
		if(res<=0) cout<<"0\n";
		else cout<<res<<'\n';
	}	
}

Measured memory_bytes: 3104
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		new A1129().ans(sc);

	}

}

class A1500 {
	int count1500 = 0;

	public void ans(Scanner sc) {
		int len = sc.nextInt();
		sc.nextLine();
		String id = sc.nextLine();
		int x = sc.nextInt();
		ArrayList<Integer> pa = new ArrayList<Integer>();
		ArrayList<Integer> po = new ArrayList<Integer>();
		for (int i = 0; i < x; i++) {
			pa.add(sc.nextInt());
			if (pa.get(i) % 2 == 0) {

			} else {
				po.add(pa.get(i));
			}
		}

		int sum = 0;
		int even = 0;
		int odd = 0;

		for (int i = 0; i < id.length(); i++) {
			int t = id.length() - i - 1;

			char c = id.charAt(t);
			if (c == '*') {
				if (t % 2 == 0) {
					even++;
				} else {
					odd++;
				}
			} else {
				int d = Integer.parseInt(String.valueOf(c));
				if (t % 2 == 0) {
					sum += (d / 10) + (d % 10);
				} else {
					sum += d;
				}
			}
		}

		System.out.println(sum);
		System.out.println(even);
		System.out.println(odd);

		System.out.println(id);
	}

	void re1500(int sum, int even, int odd, ArrayList<Integer> pa,
			ArrayList<Integer> po) {
		if (even == 0 && odd == 0) {

		} else {
			if (sum % 2 == 0) {

			} else {
				if (odd > 0) {
					for (Iterator iterator = po.iterator(); iterator.hasNext();) {
						Integer integer = (Integer) iterator.next();
						re1500(sum + integer, even, odd - 1, pa, po);
					}
				}
			}
		}
	}

}

class A1129 {
	
	public void ans(Scanner sc) {
		
		while(true){
			int n = sc.nextInt();
			int r = sc.nextInt();
			
			if(n==0){
				break;
			}
			LinkedList<Integer> yama = new LinkedList<Integer>();
			for (int i = 0; i < n; i++) {
				yama.addFirst(i+1);
			}
			for (int i = 0; i < r; i++) {
				int p = sc.nextInt();
				int c = sc.nextInt();
				
				for (int j = 0; j < c; j++) {
					yama.add(j,yama.remove(p+j-1));
				}
			}
			System.out.println(yama.getFirst());
		}
		
	}
	
}

Measured memory_bytes: 32196
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
struct Node{
    int x;
    int y;
    bool operator <(const Node &a)
    {
        return x<a.x;
    }
};
int main()
{
    ll n,k;
    Node node[100005];
    scanf("%lld%lld",&n,&k);
    for(int i=0;i<n;i++)
    {
        scanf("%d%d",&node[i].x,&node[i].y);
    }
        sort(node,node+n);
        ll sum=0;
        for(int i=0;i<n;i++)
        {
            sum+=node[i].y;
            if(sum>=k)
            {
                printf("%d\n",node[i].x);
                break;
            }
        }
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);	

	int x, y;
	cin >> x >> y;
	if (x % y) {
		cout << x << endl;
	} else {
		cout << -1 << endl;
	}
}


Measured memory_bytes: 3112
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<math.h>
#include<limits>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0;i < (n); ++i)

int main() {
	int n,k;
	cin >> n >> k;
	vector<int>p(n);
	rep(i, n)cin >> p[i];

	sort(p.begin(), p.end());
	int ans = 0;
	rep(i, k) {
		ans += p[i];
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3628
from collections import defaultdict
import sys
sys.setrecursionlimit(10**6)
def ReadInput():
	return [int(i) for i in input().split(" ")]
(R, C) = ReadInput()
N = int(input())
VectorSet = set() 
Grid = defaultdict(list)
for i in range(N):
	(r, c, a) = ReadInput()
	Grid[("R", r)].append((("C", c), a))
	Grid[("C", c)].append((("R", r), a))
	VectorSet.add(("R", r))
	VectorSet.add(("C", c))
def iteration(vector):
	VectorSet.discard(vector)
	for (v, a) in Grid[vector]:
		temp = a - VectorCover[vector]
		if (v in VectorCover):
			if(temp != VectorCover[v]):
				print("No")
				exit()
		else:
			VectorCover[v] = temp
			iteration(v) 
while(len(VectorSet) != 0):
	vector = VectorSet.pop()
	VectorCover = dict() 
	VectorCover[vector] = 0
	iteration(vector)
	minR = min(a for (p, a) in VectorCover.items() if (p[0] == "R"))
	minC = min(a for (p, a) in VectorCover.items() if (p[0] == "C"))
	if (minR + minC < 0):
		print("No")
		exit()
print("Yes")

Measured memory_bytes: 166996
<?php

    $ct = trim(fgets(STDIN));
    $num_list = explode(" ",trim(fgets(STDIN)));
    
    $min = min($num_list);
    $max = max($num_list);
    $sum = array_sum($num_list);
    
    echo $min . " " . $max . " " . $sum;

?>



Measured memory_bytes: 10848
class BIT():

    __slots__ = ["n", "data"]

    def __init__(self, length_or_list):
        if isinstance(length_or_list, int):
            self.n = length_or_list + 1
            self.data = [0] * self.n
        else:
            self.n = len(length_or_list) + 1
            self.data = [0] + length_or_list
            for i in range(1, self.n):
                if i + (i & -i) < self.n:
                    self.data[i + (i & -i)] += self.data[i]        

    def point_append(self, index, delta):
        index += 1
        while index < self.n:
            self.data[index] += delta
            index += index & -index
        
    def prefix_folded(self, end):
        res = 0
        while end: # 変更箇所
            res += self.data[end]
            end -= end & -end
        return res

    def folded(self, begin, end):
        ret = 0
        while begin < end:
            ret += self.data[end]
            end -= end & -end
        while end < begin:
            ret -= self.data[begin]
            begin -= begin & -begin
        return ret

def main():
    import sys
    input = sys.stdin.buffer.readline

    N, Q = map(int, input().split())
    bit = BIT(list(map(int, input().split())))
    ans = []
    for _ in range(Q):
        a, b, c = map(int, input().split())
        if a:
            ans.append(bit.folded(b, c))
        else:
            bit.point_append(b, c)

    print('\n'.join(map(str, ans)))

if __name__ == "__main__":
    main()

Measured memory_bytes: 169460
<?php
// 入力
fscanf(STDIN, "%d", $N);
$aList = explode(" ", trim(fgets(STDIN)));

$flag = true;
foreach($aList as $v) {
	if(($v % 2) == 0) {
		if(($v % 3) != 0 && ($v % 5) != 0) {
			$flag = false;
			break;
		}
	}
}

if($flag) {
	echo "APPROVED\n";
}
else {
	echo "DENIED\n";
}


Measured memory_bytes: 4856
#include <bits/stdc++.h>
using namespace std;
const int maxn=1005;
int n,x[maxn],y[maxn];
int main()
{
    scanf("%d",&n);
    for (int i=1;i<=n;++i) scanf("%d%d",&x[i],&y[i]);
    long long a=1,b=1;
    for (int i=1;i<=n;++i) {
        long long mmin=max((a+x[i]-1)/x[i],(b+y[i]-1)/y[i]);
        a=mmin*x[i];
        b=mmin*y[i];
    }
    cout<<a+b<<endl;
    return 0;
}


Measured memory_bytes: 3688
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
int main()
{
    char s[100005];
    scanf("%s",s);
    int n=strlen(s);
    for(int i=0;i<n;i++)
        if(i%2==0)
        printf("%c",s[i]);
    printf("\n");
    return 0;
}


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


#define M 1000000007
#define pb push_back
#define mp make_pair
#define s second
#define f first
#define mod 998244353
#define sz(v) (int)(v).size()

#define pii pair<int, int>
#define vi vector<int>
#define ll long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(0)

ll add(ll a,ll b)
{
	a%=M;
	b%=M;
	ll p = (a+b)%M;
	return (p+M)%M;
}

ll mul(ll a,ll b)
{
	a%=M;
	b%=M;
	ll p = (a*b)%M;
	return (p+M)%M;
}

ll dp[200010][4]={0};

int main()
{
	fastio;
	ll i,n,a[200010];
	cin>>n;
	for(i=0;i<n;i++)
		cin>>a[i];
	ll sum=0,ma=-1e15;
	// if(	n%2==0)
	// {
	// 	ll pre[200010]={0},suf[200010]={0};
	// 	for(i=0;i<n;i+=2)
	// 		sum+=a[i];
	// 	ma=max(ma,sum);
	// 	sum=0;
	// 	for(i=1;i<n;i+=2)
	// 		sum+=a[i];
	// 	ma=max(ma,sum);
	// 	pre[0]=a[0];
	// 	pre[1]=a[1];
	// 	for(i=1;i<n;i++)
	// 		pre[i]=pre[i-2]+a[i];
	// 	for(i=n-1;i>=0;i--)
	// 		suf[i]=suf[i+2]+a[i];
	// 	for(i=0;i<n;i++)
	// 		ma=max(ma,pre[i]+suf[i+3]);
	// 	cout<<ma<<endl;
	// }
	// else
	// {
	ma=-1e15;
	for(i=0;i<=n;i++)
		dp[i][0]=dp[i][1]=dp[i][2]=-1e15;
	dp[1][0]=a[0];
	dp[2][1]=a[1];
	dp[3][0]=a[0]+a[2];
	dp[3][2]=a[2];
	for(i=4;i<=n;i++)
	{
		dp[i][2]=max(dp[i-2][2],max(dp[i-3][1],dp[i-4][0]))+a[i-1];
		dp[i][1]=max(dp[i-2][1],dp[i-3][0])+a[i-1];
		dp[i][0]=dp[i-2][0]+a[i-1];
	}
	if(n&1)
		ma=max(dp[n][2],max(dp[n-1][1],dp[n-2][0]));
	else
		ma=max(dp[n][1],dp[n-1][0]);
	cout<<ma<<endl;
	// }
    return 0;
}





Measured memory_bytes: 11440
l,r = map(int,input().split())

if r - l > 2019:
    print(0)
else:
    tres = 2019
    for i in range(l,r):
        for j in range(i+1,r+1):
            mod = (i % 2019) * (j % 2019) % 2019
            tres = min(tres,mod)
    print(tres)


Measured memory_bytes: 2940
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;
typedef priority_queue<VL> PQ_DESC_VL;
typedef priority_queue<VL, vector<VL>, greater<VL>> PQ_ASC_VL;
typedef priority_queue<PLL> PQ_DESC_PLL;
typedef priority_queue<PLL, vector<PLL>, greater<PLL>> PQ_ASC_PLL;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    int x,n;cin>>x>>n;

    set<int> m;
    REP(i, n){
        int p;cin>>p;
        m.insert(p);
    }

    REP(i,1000){
        if(m.find(x-i) == m.end()){
            cout<<x-i<<endl;
            return;
        }
        if(m.find(x+i) == m.end()){
            cout<<x+i<<endl;
            return;
        }
    }

    
    
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

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

int main() {
	int n;
	cin >> n;
	vector<int>a(n);
	ll total = 0;
	vector<int>opt;
	for (int i = 0; i < n; i++) {
		cin >> a.at(i);
		total += a.at(i);
		if (a.at(i) % 10 != 0)opt.push_back(a.at(i));
	}
	sort(a.begin(), a.end());
	sort(opt.begin(), opt.end());
	if (total % 10 != 0) {
		cout << total << endl;
		return 0;
	}
	if (opt.size() != 0) cout << total - opt.at(0) << endl;
	else cout << 0 << endl;
}

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

int main(){
  int x,N;
  int y = 0;
  int i = 0;
  int w = 0;
  int z = 1000000000;
  cin>>N;
  while(i<9){
    z /= 10;
    x = (N-w)/z;
    y += x;
    w += x*z;
    i++;
  }
  if(N == N/y*y)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
} 

Measured memory_bytes: 256
import sys
input = sys.stdin.buffer.readline

from heapq import heappush, heappop

X, Y, A, B, C = map(int, input().split())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))

hP = []
hQ = []

P.sort(reverse = True)
Q.sort(reverse = True)
#print(P, Q)

for i in range(min(A, X)):
    heappush(hP, P[i])
for _ in range(X - A):
    heappush(hP, 0)
#print(hP)

for i in range(min(B, Y)):
    heappush(hQ, Q[i])
for _ in range(Y - B):
    heappush(hQ, 0)
#print(hQ)

for r in R:
    hp = heappop(hP)
    hq = heappop(hQ)
    if r <= hp and r <= hq:
        heappush(hP, hp)
        heappush(hQ, hq)
    else:
        if hp <= hq:
            heappush(hP, r)
            heappush(hQ, hq)
        else:
            heappush(hP, hp)
            heappush(hQ, r)
print(sum(hP) + sum(hQ))

Measured memory_bytes: 80348
#include <bits/stdc++.h>                                           
 
#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
 
 
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define all(x) x.begin(), x.end()
#define sz(s) (int)s.size()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define s second
#define f first
 
 
using namespace std;
 
 
typedef pair < long long, long long > pll;    
typedef pair < int, int > pii;
typedef unsigned long long ull;         
typedef vector < pii > vpii;
typedef vector < int > vi;
typedef long double ldb;  
typedef long long ll;  
typedef double db;                             
 
 
const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}, block = 555;
const pii base = mp(1171, 3307), Mod = mp(1e9 + 7, 1e9 + 9);
const int inf = 1e9, maxn = 4e5 + 148, mod = 1e9 + 7, N = 3e2 + 11;
const db eps = 1e-12, pi = 3.14159265359;
const ll INF = 1e18;


int n, k, dp[N][N], a[N];


main () {
	cin >> n >> k;
	if (n == k) {
		cout << 0;
		return 0;
	}
	forn (i, 1, n)
		cin >> a[i];

	forn (i, 0, n)
		forn (j, 0, n)
			dp[i][j] = INF;

	dp[0][0] = 0;
	forn (i, 1, n) 
		forn (j, 1, i) 
			forn (z, 0, i - 1) 
				dp[i][j] = min(dp[i][j], dp[z][j - 1] + max(0ll, a[i] - a[z])); 
	

	int ans = INF;
	forn (i, 1, n)	 
		ans = min(ans, dp[i][n - k]); 
		
	cout << ans << endl;
}


Measured memory_bytes: 1024
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()

x = int(arr_data[0][0])
t = int(arr_data[0][1])

print(x-t if x>=t else 0)




Measured memory_bytes: 3064
while 1:
    card_num = int(input())
    
    if card_num == 0:
        break

    pl_card = [input().split(" ") for i in range(card_num)]
    pl_l = 0
    pl_r = 0

    for i in pl_card:
        l = int(i[0])
        r = int(i[1])
        if l > r:
            pl_l = pl_l + (l+r)
        elif l < r:
            pl_r = pl_r + (l+r)
        elif l == r:
            pl_l = pl_l + l
            pl_r = pl_r + r
    print("{0} {1}".format(pl_l,pl_r))


Measured memory_bytes: 8056
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const int INF=1<<30,MOD=1000000007;
const ll LINF=1ll<<60;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...) _overload3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n) for(int i=n-1;i>=0;--i)
#define REPARR(i,v) for(int i=0;i<v.size();++i)
#define all(v) (v.begin()),(v.end())
#define bit(n) (1ll<<(n))
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"":"im")<<"possible"<<endl
#define Poss(n) cout<<((n)?"P":"Imp")<<"ossible"<<endl
template<typename T>ostream&operator<<(ostream&o,const vector<T>&v){o<<"{";for(T i:v)o<<i<<',';o<<"}";return o;}
template<typename T>ostream&operator<<(ostream&o,const set<T>&v){o<<"{";for(T i:v)o<<i<<',';o<<"}";return o;}
template<typename T,typename U>ostream&operator<<(ostream&o,const pair<T,U>&v){o<<"("<<v.first<<", "<<v.second<<")";return o;}

int main(){
    ll n,p;
    cin>>n>>p;
    ll ans=1;
    for(ll i = 2, _n = p; i*i <= _n; ++i) {
        ll cnt=0;
        while(p % i == 0) {
            cnt++;
            p /= i;
            if(cnt==n){
                cnt=0;
                ans*=i;
            }
        }
    }
    if(n==1)ans*=p;
    cerr<<p<<endl;
    /*if(n != 1) res[n] = 1;
    return res;*/

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


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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll s;
    cin >> s;
    ll tmp = sqrt(s);
    while(tmp*tmp < s) ++tmp;
    while(true){
        if(tmp*tmp == s){
            cout << 0 << " " << 0 << " " << tmp << " " << 0 << " " << 0 << " " << tmp << endl;
            return 0;
        }
        ll x1 = 0, y1 = 0;
        ll x2,y2,x3,y3;
        x3 = tmp;   y2 = tmp;
        ll ss = tmp*tmp - s;
        for(i = 1;i <= sqrt(ss);++i){
            if(ss%i == 0 && ss/i <= 1e9){
                x2 = i, y3 = ss/i;
                if(x3%x2 == 0 && y3%y2 == 0 && x3/x2 == y3/y2) continue;
                cout << x1 << " " << y1 << " " << x2 << " " << y2 << " " << x3 << " " << y3 << endl;
                return 0;
            }
        }
        ++tmp;
    }
    return 0;
}

Measured memory_bytes: 3648
import java.util.*;
public class Main{
		   public static void main(String[] args){
		   Scanner sc = new Scanner(System.in);
           String s=sc.next();
			   char[] ca = s.toCharArray();
		   for(int i=0;i<s.length();i++){
			   ca[i]-=3; if(ca[i]<=64)ca[i]+=26;
		   }
		   System.out.println(String.valueOf(ca));
	      }
		}

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

const int MAX_M = 28;
const int MAX_N = 8;

int N, M;
int dist[MAX_M+1][MAX_M+1];
int flag[MAX_N+1];
int res = 0;

int dfs(int pos, int depth) {
    flag[pos] = 1;
    for(int i = 1; i <= N; i++) {
        if(dist[pos][i] == 1 && flag[i] != 1) {
            dfs(i, depth+1);
            flag[i] = 0;
        } 
    }
    if(depth == N-1) res++;
    return res;
}

void solve() {
    int ans = dfs(1, 0);
    cout << ans << endl;
}

int main() {
    cin >> N >> M;
    for(int i= 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        dist[a][b] = dist[b][a] = 1;
    }
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

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

	switch(N) {
	case 1:
		std::cout << "Hello World" << std::endl;
		break;
	case 2:
	{
		int A, B;
		std::cin >> A >> B;
		std::cout << (A + B) << std::endl;
		break;
	}
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using i64 = int64_t;
using ll = long long;
int main() {
  ll n;
  cin >> n;
  vector<string> s(n);
  rep(i,n){
    cin >> s.at(i);
  }
  sort(s.begin(),s.end());
  ll kind=1;
  rep(i,n-1){
    if(s.at(i) != s.at(i+1)){
      kind ++;
    }
  }
  cout << kind <<endl;
  return 0;
}

Measured memory_bytes: 9560
#include<iostream>
#include<fstream>
#include<sstream>
#include<algorithm>
#include<cstdio>
#include<cctype>
#include<cassert>
#include<cmath>
#include<ctime>
#include<cstdlib>
#include<cstring>
#include<string>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<iomanip>
#include<utility>
using namespace std;
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define rg register
#define il inline
#define lch(x) ((x)<<1)
#define rch(x) ((x)<<1^1)
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define rep0(i,n) for(register int i=0;i<(n);++i)
#define per0(i,n) for(register int i=(n)-1;i>=0;--i)
#define rep(i,st,ed) for(register int i=(st);i<=(ed);++i)
#define per(i,ed,st) for(register int i=(ed);i>=(st);--i)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef double dbl;
typedef long double ldb;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<typename T> il T qmin(const T &a,const T &b){return a<b?a:b;}
template<typename T> il T qmax(const T &a,const T &b){return a>b?a:b;}
template<typename T> il void getmin(T &a,const T &b){if(a>b) a=b;}
template<typename T> il void getmax(T &a,const T &b){if(a<b) a=b;}
il void fileio(string s){
	freopen((s+".in").c_str(),"r",stdin);
	freopen((s+".out").c_str(),"w",stdout);
}

const int inf=(int)1e9+7;
const ll linf=(ll)1e17+7;
const int N=105;
const int mod=998244353;

il void inc(int &x,const int &y){
	x+=y;
	if(x>=mod) x-=mod;
}

typedef pair<int,ull> sta;

char s[N];
int pw[N];
vector<int> fac[N];
map<sta,int> res;
int n;

il ull hs(char *s,int len){
	ull ans=0;
	rep0(i,len) if(s[i]) ans+=pw[i];
	return ans;
}

il int calc(char *s,int len,int tp){
	ull h=hs(s,len);
	map<sta,int>::iterator tmp=res.find(mp(len<<1^tp,h)),tmp2=res.find(mp(rch(len),h));
	if(tmp!=res.end()) return tmp->Y;
	if(len==1) return !s[0]?1:2;
	int ans=0;
	if(!tp&&tmp2!=res.end()){
		ans=tmp2->Y;
	}else{
		char tmp[N];
		rep0(id,fac[len].size()){
			int l=fac[len][id];
			rep0(i,l){
				tmp[i]=1;
				for(int j=i;j<len;j+=l) tmp[i]&=s[j];
			}
			inc(ans,calc(tmp,l,0));
		}
	}
	if(tp){
		res[mp(len<<1^tp,h)]=ans;
		return ans;
	}
	rep(i,0,len-2){
		inc(ans,1ll*calc(s,i+1,1)*calc(s+i+1,len-i-1,0)%mod);
	}
	res[mp(len<<1^tp,h)]=ans;
	return ans;
}

int main(){
	pw[0]=1;
	rep(i,1,N-1) pw[i]=pw[i-1]*17;
//	fileio("test");
	scanf("%s",s);
	n=strlen(s);
	rep(i,2,n){
		fac[i].pb(1);
		for(int j=2;j*j<=i;++j){
			if(i%j) continue;
			fac[i].pb(j);
			if(j*j!=i) fac[i].pb(i/j);
		}
	}
	rep0(i,n) s[i]-='0';
	printf("%d\n",calc(s,n,0));
	return 0;
}


Measured memory_bytes: 6400
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

string s;

int main(){
	cin >> s;
	s[3] = '8';
	cout << s << endl;
}

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

using namespace std;
using lli = long long int;
long long int x, k, d;
long long int res = 1e15;
void inp()
{
    cin >> x >> k >> d;
}
void process()
{
    x = abs(x);
    long long t = abs(x/d);
    t = min(t, k);
    if (abs(x) >= d)
    {
         x = x-(t*d);
    }
    k -= t;
    res = x;
    while (k > 0 && abs(x-d) < res)
    {
        k--;
        res = abs(x-d);
        x = res;
    }
    if (k % 2 == 1)
        res = min(res+d, abs(res-d));
    cout << lli(res);
}
int main()
{
    //freopen("test.inp","r", stdin);
    inp();
    process();
    return 0;
}


Measured memory_bytes: 3668
#include <stdio.h>

int
main(void)
{
	int r, c;
	int i, j;
	int a;
	int s[100] = {};

	scanf("%d%d", &r, &c);

	for (i = 0; i < r; i++) {
		int sum = 0;
		for (j = 0; j < c; j++) {
			scanf("%d", &a);
			printf("%d ", a);
			sum += a;
			s[j] += a;
		}
		printf("%d\n", sum);
	}

	for (j = 0, a = 0; j < c; j++) {
		printf("%d ", s[j]);
		a += s[j];
	}
	printf("%d\n", a);

	return 0;
}



Measured memory_bytes: 2052
function main()
    n = parse(Int, readline())
    s = readline()
    count = 0
    counts = [Int[], Int[], Int[]] #RGB
    x,y,z = 0,0,0
    hoge = 0
    @simd for i in 1:n
        aa = min(i-1, n-i)
        @simd for j in 1:aa
            if s[i] != s[i-j] != s[i+j] != s[i]
                # println(s[i], s[i-j], s[i+j])
                hoge += 1
            end
        end
        c = s[i]
        if c == 'R'
            x += 1
        elseif c == 'G'
            y += 1
        else
            z += 1
        end
    end
    println(x*y*z-hoge)
end

main()

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

int main() {
    //ios_base::sync_with_stdio(false);
    //cout<<setprecision(20);
    int n;
    ll a[400000];
    cin>>n;
    ll sum=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum+=a[i];
    }
    int ans=1e16;
    ll sum1=a[0]+a[1];
    ll sum2=sum-sum1;
    ll pref1=a[0];
    int j1=1;
    ll pref2=a[2];
    int j2=3;
    for(int i=2;i<n-1;i++){
        ll locans1=abs(pref1*2-sum1);
        ll locans11=abs(pref1*2-sum1+2*a[j1]);
        while(j1<i-1&&locans11<locans1){
            locans1=locans11;
            pref1+=a[j1];
            j1++;
            locans1=abs(pref1*2-sum1);
            locans11=abs(pref1*2-sum1+2*a[j1]);
        }
        ll locans2=abs(pref2*2-sum2);
        ll locans21=abs(pref2*2-sum2+2*a[j2]);
        while(j2<n-1&&locans21<locans2){
            locans2=locans21;
            pref2+=a[j2];
            j2++;
            locans2=abs(pref2*2-sum2);
            locans21=abs(pref2*2-sum2+2*a[j2]);
        }
        ll max=0;
        if(abs(pref1*2-sum1)>max)max=abs(pref1*2-sum1);
        if(abs(pref2*2-sum2)>max)max=abs(pref2*2-sum2);
        if(abs(pref1-pref2)>max)max=abs(pref1-pref2);
        if(abs(pref1+pref2-sum2)>max)max=abs(pref1+pref2-sum2);
        if(abs(pref1+pref2-sum1)>max)max=abs(pref1+pref2-sum1);
        if(abs(pref1-sum1-pref2+sum2)>max)max=abs(pref1-sum1-pref2+sum2);
        if(ans>max)ans=max;
        sum1+=a[i];
        sum2-=a[i];
        pref2-=a[i];
        if(j2==i){
            j2++;
            pref1+=a[j2];
        }
    }
    cout<<ans;
    return 0;
}

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

void solve(){
  ll N;
  cin>>N;
  ll ans=0;
  if (N%2==1){
    cout<<ans<<endl;
  }else{
    ll d=10;
    while(N>=d){
      ans+=N/d;
      d*=5;
    }
    cout<<ans<<endl;
  }   
  return;
}

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


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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  rep(i,N) cin >> A.at(i);
  sort(A.begin(), A.end());
  K = min(N,K);
  ll sum = 0;
  rep(i,K){
    A.pop_back();
  }
  rep(i,A.size()) sum += A.at(i);
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <math.h>
#define log(x) cout<<x<<endl
#define pb push_back
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
using namespace std;
int main(){
    string s,a,b,c;
    bool r = true;
    cin>>s;
    a=s.substr(0,1);
    b=s.substr(1,1);
    c=s.substr(2,1);
    if(a==b&&b==c){
      r = false;
    }
    if(r){
      cout<<"Yes";
    }
    else{
      cout<<"No";
    }



}

Measured memory_bytes: 256
// B.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
using namespace std;
int main()
{
    int n;

    cin >> n;

    for (int i = n; i < 1000; i++) {
        int a = i % 10;
        int b = (i / 10) % 10;
        int c = i / 100;

        if (a == b && b == c) {
            cout << i << endl;
            break;
        }
    }
    return 0;
}



Measured memory_bytes: 3640
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = null;
		try {
			scanner = new Scanner(System.in);
			execute(scanner);
		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private static void execute(Scanner scanner) {
		int n = scanner.nextInt();
		int[] d = new int[n];
		for (int i = 0; i < n; i++) {
			d[i] = scanner.nextInt();
		}
		int m = scanner.nextInt();
		int[] t = new int[m];
		for (int i = 0; i < m; i++) {
			t[i] = scanner.nextInt();
		}
		Arrays.sort(d);
		Arrays.sort(t);
		int j = 0;
		for (int i = 0; i < m; i++) {
			while (j < n && t[i] != d[j]) {
				j++;
			}
			if (j < n && t[i] == d[j]) {
				j++;
				continue;
			}
			if (j == n) {
				System.out.println("NO");
				return;
			}
		}
		System.out.println("YES");
	}
}


Measured memory_bytes: 96492
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]


def main():
    n=II()
    xy=[LI() for _ in range(n)]
    sx=sy=1000
    bx=by=0
    for x,y in xy:
        if x<sx:sx=x
        if x>bx:bx=x
        if y<sy:sy=y
        if y>by:by=y
    x0=(sx+bx)/2
    y0=(sy+by)/2
    m=100
    roop=10000
    for _ in range(roop):
        maxd=0
        for x,y in xy:
            d=(x-x0)**2+(y-y0)**2
            if d>maxd:
                maxd=d
                vx=x-x0
                vy=y-y0
        rate=m/(vx**2+vy**2)**0.5
        x0+=vx*rate
        y0+=vy*rate
        m*=0.998
    print(maxd**0.5)

main()

Measured memory_bytes: 3188
N,M,C = list(map(int,input().split()))
B = list(map(int,input().split()))
A = [list(map(int,input().split())) for i in range(N)]
answer = 0

for i in range(N):
    score = C
    for j in range(M):
        score += A[i][j] * B[j]
    if score > 0:
        answer += 1

print(answer)

Measured memory_bytes: 9196
#include<stdio.h>
int main()
{
  int n[3]={0},i,j,a;

  scanf("%d %d %d",&n[0],&n[1],&n[2]);

  for(i=0;i<3;i++)
    {
      for(j=i;j<3;j++)
        {
          if(n[i] > n[j]){
            a=n[i];
            n[i]=n[j];
            n[j]=a;
          }
        }
    }

  printf("%d %d %d\n",n[0],n[1],n[2]);

  return 0;
}

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

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

   char ans;

   switch(b) {
    case 'A':
    ans = 'T';
    break;

    case 'T':
    ans = 'A';
    break;

    case 'C':
    ans = 'G';
    break;

    case 'G':
    ans = 'C';
    break;
   }

   cout << ans << endl;
}

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

using namespace std;

#define fastio ios::sync_with_stdio(0);cin.tie(0);
typedef long long ll;


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

	int n;
	cin >> n;
	if(n == 0)
		cout << 1;
	else
		cout << 0;
	
	return 0;

}

Measured memory_bytes: 3644
class Quiz(object):
    def __init__(self, n, k, answers):
        self._n = n
        self._k = k
        self._answers = answers

    def _solve(self):
        points = [0 for _ in range(self._n)]

        for a in self._answers:
            points[a - 1] = points[a - 1] + 1

        return points

    def get_answers(self):
        points = self._solve()
        q = len(self._answers)
        return ['Yes' if self._k - q + p > 0 else 'No' for p in points]


def main():
    conditions = input()
    c = conditions.split(' ')

    n = int(c[0])
    k = int(c[1])
    q = int(c[2])

    answers = []
    for i in range(q):
        answers.append(int(input().strip()))

    p = Quiz(n, k, answers)
    print('\n'.join(p.get_answers()))


if __name__ == '__main__':
    main()


Measured memory_bytes: 8688
n = int(input())
s = [input() for _ in range(n)]
j = [0]*4

for i in range(n):
    if s[i] == "AC":
        j[0] += 1
    elif s[i] == "WA":
        j[1] += 1
    elif s[i] == "TLE":
        j[2] += 1
    else :
        j[3] += 1

print("AC x {}".format(j[0]))
print("WA x {}".format(j[1]))
print("TLE x {}".format(j[2]))
print("RE x {}".format(j[3]))

Measured memory_bytes: 16216
#include <iostream>
#include <algorithm>
using namespace std;
const int INF = 1 << 25;

int cmin[100][100];
int tmin[100][100];

int main() {
	int n, m, query;
	while (cin >> n >> m , n) {
		for (int i = 0; i < m; i++) {
			for (int j = 0; j < m; j++) {
				cmin[i][j] = (i == j) ? 0 : INF;
				tmin[i][j] = (i == j) ? 0 : INF;
			}
		}

		while (n--) {
			int a, b, c, t;
			cin >> a >> b >> c >> t;
			cmin[a - 1][b - 1] = cmin[b - 1][a - 1] = c;
			tmin[a - 1][b - 1] = tmin[b - 1][a - 1] = t;
		}

		for (int k = 0; k < m; k++) {
			for (int i = 0; i < m; i++) {
				for (int j = 0; j < m; j++) {
					cmin[i][j] = min(cmin[i][j], cmin[i][k] + cmin[k][j]);
					tmin[i][j] = min(tmin[i][j], tmin[i][k] + tmin[k][j]);
				}
			}
		}

		cin >> query;
		while (query--) {
			int p, q, r;
			cin >> p >> q >> r;
			if (r == 0) {
				cout << cmin[p - 1][q - 1] << endl;
			}
			else {
				cout << tmin[p - 1][q - 1] << endl;
			}
		}
	}
}

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

int main(){
  int N;
  cin >> N;
  vector<int64_t> vec(100);
  vec.at(0) = 2;
  vec.at(1) = 1;
  
  for(int i = 2; i <= N; i++){
    vec.at(i) = vec.at(i-1) + vec.at(i-2); 
  }
  cout << vec.at(N) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intput(i) cout << i << endl
#define ll long long
#define stringput(s) cout << (string)(s) << endl


int main(){
  ll K, N;
  cin >> K >> N;
  vector<ll> A(N);
  rep(i, N) cin >> A[i];
  vector<ll> dif(N);
  rep(i, N-1){
    dif[i] = abs(A[i+1] - A[i]);
  }
  dif[N-1] = A[0] + K - A[N-1];
  int M = *max_element(dif.begin(),dif.end());
  cout << K - M << endl;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

ll a[100010];
int main() {
	ll n;
	cin>>n;
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		a[x]++;
	}
	ll ans=0;
	for(int i=0;i<100010-2;i++){
		ll now=a[i]+a[i+1]+a[i+2];
		ans=max(ans,now);
	}
	cout << ans;
    // your code goes here
	return 0;
}

Measured memory_bytes: 1024
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    get!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty |) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty | $n:expr) => {
        (0..$n).map(|_| get!($t |)).collect::<Vec<_>>()
    };
}

macro_rules! tern {
    ($condition: expr, $_true: expr, $_false: expr) => {
        if $condition {
            $_true
        } else {
            $_false
        }
    };
}

fn main() {
    let (N, Q) = get!(usize, usize);
    let abs = get!(usize, usize; N-1);
    let pxs = get!(usize, usize; Q);
    let mut counts = vec![0; N+1];
    for (p, x) in pxs {
        counts[p] += x;
    }
    let mut tree = vec![Vec::new(); N+1];
    for &(a, b) in &abs {
        tree[a].push(b);
        tree[b].push(a);
    }
    let mut sums = vec![0; N+1];
    let mut stack = std::collections::VecDeque::new();
    let mut visited = vec![false; N+1];
    stack.push_back((1, 0));
    while let Some((n, sum)) = stack.pop_back() {
        visited[n] = true;
        sums[n] = sum + counts[n];
        for &c in &tree[n] {
            if !visited[c] {
                stack.push_back((c, sum + counts[n]));
            }
        }
    }
    for sum in sums.iter().skip(1) {
        print!("{} ", sum);
    }
    println!();
}


Measured memory_bytes: 34836
#include<stdio.h>
int main(){
  long n,i,max=0,min=0,ans1[200],ans2[200],count=0;
  long long int a[60];
  scanf("%ld", &n);
  for(i=0;i<n;i++){
    scanf("%lld",&a[i]);
    if(i==0){
      max=i;
      min=i;
    }
    if(a[max]<a[i])max=i;
    if(a[min]>a[i])min=i;
  }
  if(a[max]==a[min]){
    puts("0");
    return 0;
  }
  else if(abs(a[min])<=abs(a[max])){
    for(i=1;i<n;i++){
      while(a[i-1]>a[i]){
        a[i]+=a[max];
        ans1[count]=max+1;
        ans2[count]=i+1;
        count++;
      }
      if(a[max]<=a[i])
        max=i;
    }
  }
  else {
    for(i=n-2;i>=0;i--){
      while(a[i+1]<a[i]){
        a[i]+=a[min];
        ans1[count]=min+1;
        ans2[count]=i+1;
        count++;
      }
      if(a[min]>=a[i])
        min=i;
    }
  }
  printf("%ld\n",count);
  for(i=0;i<count;i++) printf("%ld %ld\n",ans1[i],ans2[i]);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

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

    if (a == 1 || b == 1) {
        if (a == b) {
            cout << "Draw" << endl;
        } else if (a == 1) {
            cout << "Alice" << endl;
        } else {
            cout << "Bob" << endl;
        }
    } else {
        if (a == b) {
            cout << "Draw" << endl;
        } else if (a > b) {
            cout << "Alice" << endl;
        } else {
            cout << "Bob" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
N, M = list(map(int, input().split()))
d = [list(map(int, input().split())) for _ in range(N)]
ans = 0
d.sort()
for i in d:
    if i[1] <= M:
        ans += i[0] * i[1]
        M -= i[1]
        if M == 0:
            break
    else:
        ans += i[0] * M
        break

print(ans)

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

int res = 0;

void dfs(vector<vector<int> > &graph,set<int> visit,int current){
	
	//cout << "--"<<endl;
	//cout << current <<endl;
	visit.insert(current);
	/*
	cout << visit.size() << " " << graph.size() <<endl;
	for(auto a : visit) cout << a << " ";
	cout <<endl;*/
	if(visit.size() == graph.size()){
		res++;
		return;
	}
	
	for(auto next : graph[current]){
		if(visit.find(next) == visit.end()){
			dfs(graph,visit,next);
		}
	}
}

int main(){
	int n,m;
	cin >>n >> m;
	
	
	vector<vector<int> > graph(n);
	int a,b;
	
	for(int i=0;i<m;++i){
		cin >> a >> b;
		a--;b--;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
	set<int> visit;
	
	dfs(graph,visit,0);
	
	cout << res <<endl;
	
	return 0;
}



Measured memory_bytes: 256